public function actionSave($languageId = null, $categoryId = null)
 {
     if (!empty($categoryId)) {
         $category = Category::findOne($categoryId);
         $category_translation = CategoryTranslation::find()->where(['category_id' => $categoryId, 'language_id' => $languageId])->one();
         if (empty($category_translation)) {
             $category_translation = new CategoryTranslation();
         }
     } else {
         $category = new Category();
         $category_translation = new CategoryTranslation();
     }
     if (Yii::$app->request->isPost) {
         $category->load(Yii::$app->request->post());
         $category_translation->load(Yii::$app->request->post());
         if ($category->validate() && $category_translation->validate()) {
             $category->save();
             $category_translation->category_id = $category->id;
             $category_translation->language_id = $languageId;
             $category_translation->save();
             Yii::$app->getSession()->setFlash('success', 'Data were successfully modified.');
             return $this->redirect(Url::toRoute('/articles/category'));
         } else {
             Yii::$app->getSession()->setFlash('danger', 'Failed to change the record.');
         }
     }
     return $this->render('edit', ['category' => $category, 'category_translation' => $category_translation, 'categories' => Category::find()->with('translations')->all(), 'selectedLanguage' => Language::findOne($languageId), 'languages' => Language::findAll(['active' => true])]);
 }