/**
  * Attach a category to parent given
  * 
  * @access public
  * @param CMS_moduleCategory $category 
  * @param CMS_moduleCategory $parentCategory 
  * @return boolean true on success, false on failure
  */
 static function attachCategory(&$category, &$parentCategory)
 {
     if (!$parentCategory 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 ($parentCategory->getID() > 0 && $category->hasParent($parentCategory)) {
         CMS_grandFather::raiseError("Category is already child of parent given");
         return false;
     }
     CMS_moduleCategories_catalog::compactSiblingsOrder($parentCategory);
     $category->setAttribute('parentID', $parentCategory->getID());
     if ($parentCategory->isRoot()) {
         $category->setAttribute('rootID', $parentCategory->getID());
     } else {
         $category->setAttribute('rootID', $parentCategory->getAttribute('rootID'));
     }
     $order = CMS_moduleCategories_catalog::getLastSiblingOrder($parentCategory->getID()) + 1;
     $category->setAttribute('order', $order);
     return $category->writeToPersistence();
 }