def _post_to_payload(post):
    """Convert the instance of Post to data to create or update api call.

    :type post: Post
    :param post: The post to request.

    :rtype: dict
    :returns: The post data to send to DocBase API.

    """
    payload = {
        'title': post.title,
        'body': post.body,
        'draft': post.draft,
        'notice': post.notice,
        'tags': [tag for tag in post.tags],
        'scope': post.scope,
    }

    if post.scope == 'group':
        payload['groups'] = [g.id for g in post.groups]

    return payload