def METHOD_NAME(sender, instance, created, **kwargs):
    # Determine the root of the post.
    root = instance.root if instance.root is not None else instance
    # Update last contributor, last editor, and last edit date to the thread
    Post.objects.filter(uid=root.uid).update(lastedit_user=instance.lastedit_user,
                                             lastedit_date=instance.lastedit_date)
    # Get newly created subscriptions since the last edit date.
    subs = Subscription.objects.filter(date__gte=instance.lastedit_date, post=instance.root)
    extra_context = dict()
    if created:
        # Make the uid user friendly
        instance.uid = instance.uid or f"9{instance.pk}"
        if instance.parent:
            # When the parent is set the root must follow the parent root.
            instance.root = instance.parent.root
        else:
            # When there is no parent, root and parent are set to itself.
            instance.root = instance.parent = instance
        # Answers and comments may only have comments associated with them.
        if instance.parent.type in (Post.ANSWER, Post.COMMENT):
            instance.type = Post.COMMENT
        # Sanity check.
        assert instance.root and instance.parent
        # Make the last editor first in the list of contributors
        # Done on post creation to avoid moderators being added for editing a post.
        instance.root.thread_users.remove(instance.lastedit_user)
        instance.root.thread_users.add(instance.lastedit_user)
        # Update this post rank on create and not every edit.
        instance.rank = instance.lastedit_date.timestamp()
        # Save the instance.
        instance.save()
        instance.update_parent_counts()
        # Bump the root rank when a new answer is added.
        if instance.is_answer:
            Post.objects.filter(uid=instance.root.uid).update(rank=util.now().timestamp())
        # Create subscription to the root.
        auth.create_subscription(post=instance.root, user=instance.author)
        # Get all subscribed users when a new post is created
        subs = Subscription.objects.filter(post=instance.root)
        # Notify users who are watching tags in this post
        tasks.notify_watched_tags.spool(uid=instance.uid, extra_context=extra_context)
        # Send out mailing list when post is created.
        tasks.mailing_list.spool(uid=instance.uid, extra_context=extra_context)
    # Set the tags on the instance.
    if instance.is_toplevel:
        tags = [Tag.objects.get_or_create(name=name)[0] for name in instance.parse_tags()]
        instance.tags.clear()
        instance.tags.add(*tags)
    # Ensure spam posts get closed status
    if instance.is_spam:
        Post.objects.filter(uid=instance.uid).update(status=Post.CLOSED)
    if not instance.is_toplevel:
        # Title is inherited from top level.
        title = f"{instance.get_type_display()}: {instance.root.title[:80]}"
        Post.objects.filter(uid=instance.uid).update(title=title)
    # Ensure posts get re-indexed after being edited.
    Post.objects.filter(uid=instance.uid).update(indexed=False)
    # Exclude current authors from receiving messages from themselves
    subs = subs.exclude(Q(type=Subscription.NO_MESSAGES) | Q(user=instance.author))
    sub_ids = list(subs.values_list('id', flat=True))
    # Notify subscribers
    tasks.notify_followers.spool(sub_ids=sub_ids,
                                 author_id=instance.author.pk,
                                 uid=instance.uid,
                                 extra_context=extra_context)