public function run($id)
    {
        $model = $this->getModel($id);
        $model->setScenario($this->scenario);
        if ($model->load(Yii::$app->getRequest()->post())) {
            if (Yii::$app->getRequest()->isAjax) {
                Yii::$app->getResponse()->format = Response::FORMAT_JSON;
                return ActiveForm::validate($model);
            }
            if ($model->save()) {
                $this->addSuccessFlash();
                return $this->redirect($model);
            } else {
                $this->addErrorFlash();
            }
        }

        return $this->controller->render($this->view, [
            $this->nameVariableModel => $model,
        ]);
    }