def METHOD_NAME() -> flask.wrappers.Response:
    user = get_user_from_request()
    group = get_group_from_request()
    user_group_assignment = UserGroupAssignmentModel.query.filter_by(user_id=user.id, group_id=group.id).first()
    if user_group_assignment is not None:
        raise (
            ApiError(
                error_code="user_is_already_in_group",
                message=f"User ({user.id}) is already in group ({group.id})",
                status_code=409,
            )
        )
    user_group_assignment = UserGroupAssignmentModel(user_id=user.id, group_id=group.id)
    db.session.add(user_group_assignment)
    db.session.commit()
    return Response(
        json.dumps({"id": user_group_assignment.id}),
        status=201,
        mimetype=APPLICATION_JSON,
    )