public function addTeam() { $data = $this->getJsonRequest(); if (!$data) { return $this->serverError(); } try { $entity = $this->team_manager->registerTeam($data); return $this->created($entity->getIdentifier()); } catch (TeamAlreadyExistsException $ex1) { SS_Log::log($ex1, SS_Log::NOTICE); return $this->validationError(array(array('attribute' => 'error', 'message' => 'Team Already exist on Company!'))); } catch (EntityValidationException $ex2) { SS_Log::log($ex2, SS_Log::NOTICE); return $this->validationError($ex2->getMessages()); } catch (Exception $ex) { SS_Log::log($ex, SS_Log::ERR); return $this->serverError(); } }