public function addAction()
 {
     $success = false;
     $report = CustomReport\Config::getByName($this->getParam("name"));
     if (!$report) {
         $report = new CustomReport\Config();
         $report->setName($this->getParam("name"));
         $report->save();
         $success = true;
     }
     $this->_helper->json(["success" => $success, "id" => $report->getName()]);
 }
 public function addAction()
 {
     try {
         CustomReport\Config::getByName($this->getParam("name"));
         $alreadyExist = true;
     } catch (\Exception $e) {
         $alreadyExist = false;
     }
     if (!$alreadyExist) {
         $report = new CustomReport\Config();
         $report->setName($this->getParam("name"));
         $report->save();
     }
     $this->_helper->json(array("success" => !$alreadyExist, "id" => $report->getName()));
 }