/**
  * Updates an existing Book model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $searchModel = new BookSearch();
     $authors = $searchModel->getAuthors()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $url = Yii::$app->session->get('lastBookIndexUrl');
         if (!$url) {
             $url = "/";
         }
         return $this->redirect($url);
     } else {
         return $this->render('update', ['model' => $model, 'authors' => $authors]);
     }
 }