public function save()
 {
     if ($this->validate()) {
         //save cover file
         if ($this->cover) {
             $filename = $this->cover->baseName . '.' . $this->cover->extension;
             $destination = Yii::getAlias('@app/web') . '/upload/' . $filename;
             $this->cover->saveAs($destination);
         } else {
             $filename = '';
         }
         //save data
         if ($this->id) {
             /*
              * Find game by PK to update existing game
              */
             $game = Game::findOne($this->id);
         } else {
             /*
              * Create object game to insert new game
              */
             $game = new Game();
             $game->created_at = time();
         }
         $game->title = $this->title;
         $game->content = $this->content;
         if ($filename) {
             $game->cover = $filename;
         }
         if ($this->author_id) {
             $game->author_id = $this->author_id;
         } else {
             $game->author_id = Yii::$app->user->getId();
         }
         $game->updated_at = time();
         if ($game->save()) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }