/**
  * Prevents invalid calls to the site respository in case the site data property is not available.
  *
  * @return null|object
  */
 protected function getCurrentSite()
 {
     if (!isset($this->data['site']) || $this->data['site'] === null) {
         return null;
     }
     return $this->siteRepository->findByIdentifier($this->data['site']);
 }
 /**
  * Returns the node this even refers to, if it can be resolved.
  *
  * It might happen that, if this event refers to a node contained in a site which is not available anymore,
  * Doctrine's proxy class of the Site domain model will fail with an EntityNotFoundException. We catch this
  * case and return NULL.
  *
  * @return NodeInterface
  */
 public function getNode()
 {
     try {
         $context = $this->contextFactory->create(array('workspaceName' => $this->userService->getUserWorkspace()->getName(), 'dimensions' => $this->dimension, 'currentSite' => $this->siteRepository->findByIdentifier($this->data['site']), 'invisibleContentShown' => true));
         return $context->getNodeByIdentifier($this->nodeIdentifier);
     } catch (EntityNotFoundException $e) {
         return null;
     }
 }