public function create(ViewEvent $event)
 {
     if (null === ($view = ViewQuery::create()->filterBySourceId($event->getSourceId())->findOneBySource($event->getSource()))) {
         $view = new View();
     }
     if ($event->hasDefinedViews()) {
         $view->setView($event->getViewName())->setSource($event->getSource())->setSourceId($event->getSourceId())->setSubtreeView($event->getSubtreeView())->setChildrenView($event->getChildrenView())->save();
     } else {
         $view->delete();
     }
 }