/**
  * This method removes a notification.
  */
 public function remove()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $itemId = $this->input->getUint('id');
     $userId = JFactory::getUser()->get('id');
     $response = new Prism\Response\Json();
     $validatorOwner = new Socialcommunity\Validator\Notification\Owner(JFactory::getDbo(), $itemId, $userId);
     if (!$validatorOwner->isValid()) {
         $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_FAILURE'))->setText(JText::_('COM_SOCIALCOMMUNITY_ERROR_INVALID_NOTIFICATION'))->failure();
         echo $response;
         $app->close();
     }
     try {
         $notification = new Socialcommunity\Notification\Notification(JFactory::getDbo());
         $notification->load($itemId);
         $notification->remove();
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_SUCCESS'))->setText(JText::_('COM_SOCIALCOMMUNITY_NOTIFICATION_REMOVED_SUCCESSFULLY'))->success();
     echo $response;
     $app->close();
 }