public static function get_published_course($publication) {
        try {
            list($courses, $unused) = api::get_courses('', !$publication->enrollable,
                $publication->enrollable, ['ids' => [$publication->hubcourseid], 'allsitecourses' => 1]);
            return reset($courses);
        } catch (\Exception $e) {
            \core\notification::add(get_string('errorcourseinfo', 'hub', $e->getMessage()),
                \core\output\notification::NOTIFY_ERROR);
        }
        return null;
    }