public function pluginToXML(ModelObject $plugin)
 {
     $xml = new SimpleXMLExtended('<plugin/>');
     $info = $xml->addChild('info');
     foreach (array('Version', 'Priority', 'Title', 'Description', 'Provider', 'License', 'Dependencies', 'Homepage', 'Locked') as $key) {
         $info->addChild(StringUtils::underscore($key), trim($plugin->{$key}));
     }
     // CFVersions
     $info->addChild('cfversions', $plugin->CFVersions);
     $xml->addAttribute('id', $plugin->PluginID);
     $xml->addAttribute('slug', $plugin->Slug);
     $xml->addAttribute('installed', $plugin->isInstalled() ? 'true' : 'false');
     $xml->addAttribute('enabled', $plugin->isEnabled() ? 'true' : 'false');
     if (empty($plugin->Path)) {
         throw new Exception('Plugin path is missing');
     }
     $xml->addChild('path', $plugin->Path);
     $xml->addChild('md5', $plugin->Md5);
     // $xml->addChild('modified_date', $this->DateFactory->toStorageDate($plugin->ModifiedDate)->toMySQLDate());
     // $xml->addChild('creation_date', $this->DateFactory->toStorageDate($plugin->CreationDate)->toMySQLDate());
     return $xml;
 }