public static function action_category_resort_courses(\core_course_category $category, $sort, $cleanup = true) {
        if (!$category->can_resort_courses()) {
            throw new \moodle_exception('permissiondenied', 'error', '', null, 'core_course_category::can_resort');
        }
        return $category->resort_courses($sort, $cleanup);
    }