public function import(string $zipfilepath) : \core_analytics\model {

        list($modeldata, $mlbackenddir) = $this->extract_import_contents($zipfilepath);

        $target = \core_analytics\manager::get_target($modeldata->target);
        $indicators = [];
        foreach ($modeldata->indicators as $indicatorclass) {
            $indicator = \core_analytics\manager::get_indicator($indicatorclass);
            $indicators[$indicator->get_id()] = $indicator;
        }
        $model = \core_analytics\model::create($target, $indicators, $modeldata->timesplitting, $modeldata->processor);

        // Import them disabled.
        $model->update(false, false, false, false);

        if ($mlbackenddir) {
            $modeldir = $model->get_output_dir(['execution']);
            if (!$model->get_predictions_processor(true)->import($model->get_unique_id(), $modeldir, $mlbackenddir)) {
                throw new \moodle_exception('errorimport', 'analytics');
            }
            $model->mark_as_trained();
        }

        return $model;
    }