public function mark_as_trained() {
        global $DB;

        \core_analytics\manager::check_can_manage_models();

        $this->model->trained = 1;
        $DB->update_record('analytics_models', $this->model);
    }