def METHOD_NAME(self, instance):
    for candidate_result in instance.candidate_results.all():
        membership = candidate_result.membership
        ballot = instance.ballot
        election = ballot.election
        source = instance.source
        change_metadata = self.get_change_metadata_for_bot(source)
        if membership.elected:
            ResultEvent.objects.create(
                election=election,
                winner=membership.person,
                post=ballot.post,
                old_post_id=ballot.post.slug,
                old_post_name=ballot.post.label,
                winner_party=membership.party,
                source=source,
                user=self.user,
            )
            membership.person.record_version(change_metadata)
            membership.person.save()
            LoggedAction.objects.create(
                user=self.user,
                action_type=ActionType.SET_CANDIDATE_ELECTED,
                popit_person_new_version=change_metadata["version_id"],
                person=membership.person,
                source=source,
                edit_type=EditType.BOT.name,
            )
        else:
            change_metadata[
                "information_source"
            ] = 'Setting as "not elected" by implication'
            membership.person.record_version(change_metadata)
            membership.person.save()