public function get_category() {
        global $CFG;
        // If the category is not set, if the current user does not have the rights to change the category, or if the
        // category does not exist, we set the default category to the course to be approved.
        // The system level is used because the capability moodle/site:approvecourse is based on a system level.
        if (empty($this->properties->category) || !has_capability('moodle/course:changecategory', context_system::instance()) ||
                (!$category = core_course_category::get($this->properties->category, IGNORE_MISSING, true))) {
            $category = core_course_category::get($CFG->defaultrequestcategory, IGNORE_MISSING, true);
        }
        if (!$category) {
            $category = core_course_category::get_default();
        }
        return $category;
    }