/**
  * Moves a cateogry from its parent to another
  * 
  * @access public
  * @param CMS_moduleCategory $category 
  * @param CMS_moduleCategory $parentCategory
  * @param integer $index : the new index for the new parent (if false, put the category at last position)
  * @return boolean true on success, false on failure
  */
 static function moveCategory(&$category, &$newParentCategory, $index = false)
 {
     if (!$newParentCategory instanceof CMS_moduleCategory) {
         CMS_grandFather::raiseError("Bad parent given, not a valid CMS_moduleCategory instance");
         return false;
     }
     if (!$category instanceof CMS_moduleCategory) {
         CMS_grandFather::raiseError("Bad category given, not a valid CMS_moduleCategory instance");
         return false;
     }
     if ($category->hasParent($newParentCategory) && $index === false) {
         CMS_grandFather::raiseError("Category is already child of new parent given");
         return false;
     }
     if ($category->hasParent($newParentCategory)) {
         //this is only a change of category index so  move category to new index
         return CMS_moduleCategories_catalog::moveCategoryIndex($category, $index);
     } else {
         $oldParentCategory = $category->getParent();
         if (CMS_moduleCategories_catalog::attachCategory($category, $newParentCategory)) {
             if (!CMS_moduleCategories_catalog::compactSiblingsOrder($oldParentCategory)) {
                 CMS_grandFather::raiseError("Cannot compact sibling order for parent category");
                 return false;
             }
             if (!$index) {
                 return true;
             } else {
                 //reload category
                 $category = new CMS_moduleCategory($category->getID());
                 //then move category to new index
                 return CMS_moduleCategories_catalog::moveCategoryIndex($category, $index);
             }
         } else {
             CMS_grandFather::raiseError("Movement failed for category " . $category->getID());
             return false;
         }
     }
 }
     if (!$newParentCategory->hasError()) {
         // Detach from current category
         $oldParentCategory = $item->getParent();
         if ($item->getID()) {
             if ($oldParentCategory->getID() != $newParentCategory->getID()) {
                 if (!CMS_moduleCategories_catalog::detachCategory($item)) {
                     $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_ACTION_SAVE_ERROR);
                 }
                 // Attach to new category
                 if (!CMS_moduleCategories_catalog::attachCategory($item, $newParentCategory)) {
                     $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_ACTION_SAVE_ERROR);
                 }
             }
         } else {
             // Attach to new category
             if (!CMS_moduleCategories_catalog::attachCategory($item, $newParentCategory)) {
                 $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_ACTION_SAVE_ERROR);
             }
         }
     } else {
         $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_ACTION_SAVE_ERROR);
     }
 }
 // Save all translated datas
 foreach ($all_languages as $aLanguage) {
     $lng = $aLanguage->getCode();
     $label = sensitiveIO::request('label_' . $lng);
     $desc = sensitiveIO::request('description_' . $lng);
     $file = sensitiveIO::request('file_' . $lng);
     $item->setLabel($label, $aLanguage);
     $item->setDescription($desc, $aLanguage);