/**
  * Creates a new Diary model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Diary();
     // Set the write weighing day event handler
     $model->on(Diary::WRITE_WEIGHING_DAY_EVENT, [Yii::$app->statsService, 'onWeighingDayWrite']);
     if ($model->load($this->post()) && $model->diarySave()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render(['model' => $model]);
     }
 }