@transaction.atomic
def do_update_embedded_data(user_profile: UserProfile, message: Message, content: Optional[str], rendered_content: Optional[str]) -> None:
    event: Dict[(str, Any)] = {'type': 'update_message', 'sender': user_profile.email, 'message_id': message.id}
    changed_messages = [message]
    ums = UserMessage.objects.filter(message=message.id)
    if (content is not None):
        update_user_message_flags(message, ums)
        message.content = content
        message.rendered_content = rendered_content
        message.rendered_content_version = markdown_version
        event['content'] = content
        event['rendered_content'] = rendered_content
    message.save(update_fields=['content', 'rendered_content'])
    event['message_ids'] = update_to_dict_cache(changed_messages)

    def user_info(um: UserMessage) -> Dict[(str, Any)]:
        return {'id': um.user_profile_id, 'flags': um.flags_list()}
    send_event(user_profile.realm, event, list(map(user_info, ums)))
@transaction.atomic
def do_update_embedded_data(user_profile: UserProfile, message: Message, content: Optional[str], rendered_content: Optional[str]) -> None:
    event: Dict[(str, Any)] = {'type': 'update_message', 'sender': user_profile.email, 'message_id': message.id}
    changed_messages = [message]
    ums = UserMessage.objects.filter(message=message.id)
    if (content is not None):
        update_user_message_flags(message, ums)
        message.content = content
        message.rendered_content = rendered_content
        message.rendered_content_version = markdown_version
        event['content'] = content
        event['rendered_content'] = rendered_content
    message.save(update_fields=['content', 'rendered_content'])
    event['message_ids'] = update_to_dict_cache(changed_messages)

    def user_info(um: UserMessage) -> Dict[(str, Any)]:
        return {'id': um.user_profile_id, 'flags': um.flags_list()}
    send_event(user_profile.realm, event, list(map(user_info, ums)))