public function actionAlbumSave() { if (!empty($this->app->request->post->id)) { $item = Album::findByPK($this->app->request->post->id); } else { $item = new Album(); } $item->fill($this->app->request->post); $item->save(); $this->redirect('/admin/gallery/albums'); }