/**
  * Creates a new Revisions model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($type, $id)
 {
     $ret_val = false;
     $model = new Revisions();
     $model->setScenario('create');
     $model->parent_id = $id;
     $model->parent_type = $type;
     //Check to see if a revision was done in the last $model->interval interval
     $existing = Revisions::find()->select('id')->where(['parent_id' => $id, 'parent_type' => $type, 'author' => \Yii::$app->user->getId()])->andWhere("TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, created_at)) <= " . $model->interval)->orderBy(['id' => SORT_DESC])->one();
     switch ($existing instanceof Revisions) {
         //There was? Ok let's just update the content
         case true:
             $model->id = $existing->id;
             $model->setScenario('update');
             $model->created_at = time();
             break;
     }
     $model->author = \Yii::$app->user->getId();
     $model->setAttribute('data', json_encode($_REQUEST));
     if ($model->validate() && $model->save()) {
         //return $this->redirect(['view', 'user_id' => $model->user_id, 'remote_type' => $model->remote_type, 'remote_id' => $model->remote_id]);
         $ret_val = true;
     } else {
         /*return $this->render('create', [
               'model' => $model,
           ]);*/
     }
     return $this->renderResponse($ret_val);
 }