def METHOD_NAME(
    object_identifier: int, payload: Any, shard_identifier: int, **kwds: Any
):
    if (org_member := OrganizationMember.objects.filter(id=object_identifier).last()) is None:
        # Delete all identities that may have been associated.  This is an implicit cascade.
        if payload and payload.get("user_id") is not None:
            identity_service.delete_identities(
                user_id=payload["user_id"], organization_id=shard_identifier
            )
        organizationmember_mapping_service.delete(
            organizationmember_id=object_identifier,
            organization_id=shard_identifier,
        )
        return
    rpc_org_member_update = RpcOrganizationMemberMappingUpdate.from_orm(org_member)
    organizationmember_mapping_service.upsert_mapping(
        organizationmember_id=org_member.id,
        organization_id=shard_identifier,
        mapping=rpc_org_member_update,
    )