/**
  * Write modules to the provided path
  * @param zibo\library\filesystem\File $path Path to write the modules definitions to
  * @param array $modules Array with Module instances
  * @return null
  */
 public function writeModules(File $path, array $modules)
 {
     $dom = new Document('1.0', 'utf-8');
     $dom->formatOutput = true;
     $dom->setSchemaFileFromConfig(self::CONFIG_MODULES_SCHEMA);
     $modulesElement = $dom->createElementNS(self::XML_NAMESPACE, self::TAG_MODULES);
     $modulesElement->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', self::XML_NAMESPACE . ' ' . self::XML_NAMESPACE . ' ');
     $dom->appendChild($modulesElement);
     foreach ($modules as $namespace => $names) {
         foreach ($names as $name => $module) {
             $moduleElement = $this->getModuleElementFromModule($dom, $module, self::TAG_MODULE);
             $modulesElement->appendChild($moduleElement);
         }
     }
     $path->create();
     $file = new File($path, self::MODULE_FILE);
     $dom->save($file->getPath());
 }