public static function export_training_data($modelid, $timesplittingid) {

        $fs = get_file_storage();

        $contextid = \context_system::instance()->id;
        $filepath = '/timesplitting/' . \core_analytics\analysis::clean_time_splitting_id($timesplittingid) . '/';

        $files = $fs->get_directory_files($contextid, 'analytics', self::LABELLED_FILEAREA, $modelid,
            $filepath, true, false);

        // Discard evaluation files.
        foreach ($files as $key => $file) {
            if ($file->get_filename() === self::EVALUATION_FILENAME) {
                unset($files[$key]);
            }
        }

        if (empty($files)) {
            return false;
        }

        return self::merge_datasets($files, $modelid, $timesplittingid, self::EXPORT_FILEAREA);
    }