public function save_controller() {
        if ($this->progress >= self::PROGRESS_SAVED) {
            throw new base_ui_exception('backupuialreadysaved');
        }
        $this->progress = self::PROGRESS_SAVED;
        // First enforce dependencies.
        $this->enforce_dependencies();
        // Process UI event after to check any changes are valid.
        $this->controller->process_ui_event();
        // Save the controller.
        $this->controller->save_controller();
        return true;
    }