Create a TrackingEvent and TrackedFieldModification for an UPDATE event
    for each related model.

def _create_update_tracking_related_event(instance):
    """
    Create a TrackingEvent and TrackedFieldModification for an UPDATE event
    for each related model.
    """
    events = {}
    # Create a dict mapping related model field to modified fields
    for field, related_fields in instance._tracked_related_fields.items():
        if not isinstance(instance._meta.get_field(field), ManyToManyField):
            if isinstance(instance._meta.get_field(field), ForeignKey):
                # Compare pk
                value = getattr(instance, '{0}_id'.format(field))
            else:
                value = getattr(instance, field)
            if instance._original_fields[field] != value:
                for related_field in related_fields:
                    events.setdefault(related_field, []).append(field)

    # Create the events from the events dict
    for related_field, fields in events.items():
        try:
            related_instances = getattr(instance, related_field[1])
        except ObjectDoesNotExist:
            continue

        # FIXME: isinstance(related_instances, RelatedManager ?)
        if hasattr(related_instances, 'all'):
            related_instances = related_instances.all()
        else:
            related_instances = [related_instances]
        for related_instance in related_instances:
            event = _create_event(related_instance, UPDATE)
            for field in fields:
                fieldname = '{0}__{1}'.format(related_field[0], field)
                _create_tracked_field(
                    event, instance, field, fieldname=fieldname
                )