/**
  * Perform the action
  * @param Model $model
  * @param type $event
  * @return HistoryLog|null Returns null when nothing changes
  */
 public function performAction(Model $model, $event)
 {
     $modelPrevState = $model->getPrevState();
     $changedValues = $model->getModifiedAttributes();
     if (count($changedValues)) {
         $history = new HistoryLog();
         $history->version = $modelPrevState ? $modelPrevState->version + 1 : 0;
         $history->model_type = get_class($model);
         $history->model_id = $model->id;
         $history->user_id = $model->getUserId();
         $history->changed_value = json_encode($changedValues);
         $history->save();
         return $history;
     }
     return null;
 }