public static function download_course_backup($hubcourseid, $coursename) {
        global $CFG, $USER;
        require_once($CFG->libdir . "/filelib.php");

        $backuptempdir = make_backup_temp_directory('');
        $filename = md5(time() . '-' . $hubcourseid . '-'. $USER->id . '-'. random_string(20));
        $path = $backuptempdir.'/'.$filename.".mbz";

        api::download_course_backup($hubcourseid, $path);

        $fs = get_file_storage();
        $record = new stdClass();
        $record->contextid = context_user::instance($USER->id)->id;
        $record->component = 'user';
        $record->filearea = 'private';
        $record->itemid = 0;
        $record->filename = urlencode($coursename).'_'.time().".mbz";
        $record->filepath = '/downloaded_backup/';
        if (!$fs->file_exists($record->contextid, $record->component,
            $record->filearea, 0, $record->filepath, $record->filename)) {
            $fs->create_file_from_pathname($record, $path);
        }

        return [$record->filepath . $record->filename, $filename];
    }