/**
  * Checks for the news in the current plugin request
  *
  * @return \TYPO3\Flow\Persistence\QueryResultInterface The query result
  */
 public function getNewsFromCurrentRequest()
 {
     $pluginArguments = $this->tsRuntime->getControllerContext()->getRequest()->getPluginArguments();
     if (!empty($pluginArguments)) {
         foreach ($pluginArguments as $arguments) {
             if (!empty($arguments['@package']) && $arguments['@package'] === 'Lelesys.Plugin.News' && $arguments['@controller'] === 'News' && $arguments['@action'] === 'show' && !empty($arguments['news']['__identity'])) {
                 return $this->newsService->findById($arguments['news']['__identity']);
             }
         }
     }
 }
 /**
  * Removes the asset of news
  *
  * @param string $newsId
  * @param \TYPO3\Media\Domain\Model\Document $fileId
  * @return void
  */
 public function removeRelatedFileAction($newsId, $fileId)
 {
     try {
         $news = $this->newsService->findById($newsId);
         $this->newsService->removeRelatedFile($fileId, $news);
         echo json_encode(1);
         exit;
     } catch (Lelesys\Plugin\News\Domain\Service\Exception $exception) {
         $packageKey = $this->settings['flashMessage']['packageKey'];
         $header = 'Sorry, error occured. Please try again later.';
         $message = $this->translator->translateById('lelesys.plugin.news.try.again', array(), NULL, NULL, 'Main', $packageKey);
         $this->addFlashMessage($message, $header, \TYPO3\Flow\Error\Message::SEVERITY_ERROR);
     }
 }