/**
  * Updates an existing Page model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $firstModel = $this->findModel($id);
     foreach (Yii::$app->params['availableLocales'] as $key => $value) {
         $currentModel = Page::getLocaleInstance($key);
         $models[$key] = $currentModel::find()->andWhere(['locale_group_id' => $firstModel->locale_group_id, 'locale' => $key])->one();
         if (!$models[$key]) {
             $currentModel->attributes = $firstModel->attributes;
             $currentModel->locale_group_id = $firstModel->locale_group_id;
             $currentModel->locale = $key;
             $currentModel->title = 'title ' . $key . ' ' . time();
             $currentModel->slug = '';
             $models[$key] = $currentModel;
         }
     }
     //\yii\helpers\VarDumper::dump($models,11,1); die();
     $model = new MultiModel(['models' => $models]);
     if ($model->load(Yii::$app->request->post()) && Page::multiSave($model)) {
         return $this->redirect(['index']);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }