private MetadataFileInfo SaveMetadata(bool overwrite) { if (!overwrite) { var fileInfo = this.MetadataFiles.FirstOrDefault(fi => File.Exists(fi.FilePath)); if (fileInfo != null) { throw new IOException(string.Format(CultureInfo.CurrentCulture, MetadataResources.ErrFileAlreadyExistsFormat, fileInfo.FilePath)); } } foreach (var mfi in this.MetadataFiles) { using (XmlNS.XmlWriter xWriter = CreateXmlFile(mfi.FilePath)) { if (mfi.Write != null) { mfi.Write(xWriter); xWriter.Flush(); } } } return(GetMainWsdl()); }