def METHOD_NAME(project, tag):
    sql = """
        UPDATE userstories_userstory
           SET tags = array_remove(tags, %(tag)s)
         WHERE project_id = %(project_id)s AND %(tag)s = ANY(tags);
        UPDATE tasks_task
           SET tags = array_remove(tags, %(tag)s)
         WHERE project_id = %(project_id)s AND %(tag)s = ANY(tags);
        UPDATE issues_issue
           SET tags = array_remove(tags, %(tag)s)
         WHERE project_id = %(project_id)s AND %(tag)s = ANY(tags);
        UPDATE epics_epic
           SET tags = array_remove(tags, %(tag)s)
         WHERE project_id = %(project_id)s AND %(tag)s = ANY(tags);
    """
    cursor = connection.cursor()
    cursor.execute(sql, params={"tag": tag, "project_id": project.id})
    tags_colors = dict(project.tags_colors)
    del tags_colors[tag]
    project.tags_colors = list(tags_colors.items())
    project.save(update_fields=["tags_colors"])