public function elementToXML(ModelObject $element)
 {
     $xml = new SimpleXMLExtended('<element/>');
     $info = $xml->addChild('info');
     foreach (array('Name', 'Description', 'DefaultOrder') as $key) {
         $info->addChild(StringUtils::underscore($key), trim($element->{$key}));
     }
     // BaseURL
     $info->addChild('allow_slug_slashes', $element->isAllowSlugSlashes() ? 'true' : 'false');
     $info->addChild('base_url', $element->BaseURL);
     $info->addChild('node_class', isset($element->NodeClass) ? $element->NodeClass : 'Node');
     $xml->addAttribute('id', $element->ElementID);
     $xml->addAttribute('pluginid', $element->PluginID);
     $xml->addAttribute('slug', $element->Slug);
     // $xml->addChild('modified_date', $this->DateFactory->toStorageDate($element->ModifiedDate)->toMySQLDate());
     // $xml->addChild('creation_date', $this->DateFactory->toStorageDate($element->CreationDate)->toMySQLDate());
     $aspects = $xml->addChild('aspects');
     $aspectSlugs = (array) $element->AspectSlugs;
     if (!empty($aspectSlugs)) {
         sort($aspectSlugs);
         foreach ($aspectSlugs as $slug) {
             $aspects->addChild('aspect')->addAttribute('slug', $slug);
         }
     }
     if ($element->hasStorageFacilityInfo()) {
         foreach ($element->getStorageFacilityInfo() as $sfInfo) {
             $sf = $xml->addChild('storage_facility');
             $sf->addAttribute('for', $sfInfo->For);
             $sf->addAttribute('generate_rewrite_rules', $sfInfo->GenerateRewriteRules);
             $sf->addAttribute('ref', $sfInfo->ObjectRef);
             $sfParams = $sfInfo->StorageFacilityParams;
             $sf->addAttribute('ssl', $sfParams->isSSL() ? 'true' : 'false');
             $sf->addChild('domain', $sfParams->Domain);
             $sf->addChild('base_uri', $sfParams->BaseURI);
             $sf->addChild('base_storage_path', $sfParams->BaseStoragePath);
         }
     }
     return $xml;
 }