def METHOD_NAME(bm: BookmarkNoLink) -> Response:
    verify_logged_in()
    u = get_current_user_object()
    hide_course = False
    course_link: str | None = None
    if bm.group == MY_COURSES_GROUP:
        hide_course = True
        bks = u.bookmarks.as_dict()
        my_courses_group: BookmarkDictGroup | None = next(
            (b for b in bks if b["name"] == bm.group), None
        )
        if my_courses_group:
            for item in my_courses_group["items"]:
                if item["name"] != bm.name:
                    continue
                course_link = item["link"]
                if not course_link:
                    continue
                path = course_link[len("/view/") :]
                try:
                    ug = verify_valid_course(path)
                except CourseException:
                    continue
                self_enrolled_group_membership = next(
                    (
                        m
                        for m in u.memberships
                        if m.usergroup_id == ug.id and m.adder == u
                    ),
                    None,
                )
                if self_enrolled_group_membership:
                    self_enrolled_group_membership.set_expired()
                    # Don't hide the course if it was self-enrolled, instead just remove it fully
                    hide_course = False
    if hide_course and course_link:
        u.bookmarks.add_bookmark(HIDDEN_COURSES_GROUP, bm.name, course_link)
    u.bookmarks.METHOD_NAME(bm.group, bm.name).save_bookmarks()
    db.session.commit()
    return _bookmarks_response()