/**
  * Update a host
  *
  *
  * @method post
  * @route /hosttemplate/update
  */
 public function updateAction()
 {
     $givenParameters = $this->getParams('post');
     $macroList = array();
     $aTagList = array();
     $aTags = array();
     $aTagsTemplate = array();
     $aTagsInTpl = array();
     $aTagsIdTpl = array();
     if (isset($givenParameters['macro_name']) && isset($givenParameters['macro_value'])) {
         $macroName = $givenParameters['macro_name'];
         $macroValue = $givenParameters['macro_value'];
         $macroHidden = $givenParameters['macro_hidden'];
         foreach ($macroName as $key => $name) {
             if (!empty($name)) {
                 if (isset($macroHidden[$key])) {
                     $isPassword = '******';
                 } else {
                     $isPassword = '******';
                 }
                 $macroList[$name] = array('value' => $macroValue[$key], 'ispassword' => $isPassword);
             }
         }
     }
     if ($givenParameters['host_create_services_from_template']) {
         \CentreonConfiguration\Models\Host::deployServices($givenParameters['object_id']);
     }
     if (count($macroList) > 0) {
         try {
             CustomMacroRepository::saveHostCustomMacro(self::$objectName, $givenParameters['object_id'], $macroList);
         } catch (\Exception $ex) {
             $errorMessage = $ex->getMessage();
             $this->router->response()->json(array('success' => false, 'error' => $errorMessage));
         }
     }
     //Delete tags directilly rattached to the object
     TagsRepository::deleteTagsForResource(self::$objectName, $givenParameters['object_id'], 0);
     //Insert tags affected to the HOST
     if (isset($givenParameters['host_tags'])) {
         $aTagList = explode(",", $givenParameters['host_tags']);
         foreach ($aTagList as $var) {
             $var = trim($var);
             if (!empty($var)) {
                 array_push($aTags, $var);
             }
         }
         if (count($aTags) > 0) {
             TagsRepository::saveTagsForResource(self::$objectName, $givenParameters['object_id'], $aTags, '', false, 1);
         }
     }
     parent::updateAction();
 }