internal static XDocument GetOrCreateDocument(XName rootName, IFileSystem fileSystem, string path) { if (fileSystem.FileExists(path)) { try { using (var configSream = fileSystem.OpenFile(path)) { return(XDocument.Load(configSream)); } } catch (Exception e) { DiagnosticsClient.Notify(e); return(CreateDocument(rootName, fileSystem, path)); } } return(CreateDocument(rootName, fileSystem, path)); }