NuGet.SharedPackageRepository.SaveDocument C# (CSharp) Method

SaveDocument() private method

private SaveDocument ( System.Xml.Linq.XDocument document ) : void
document System.Xml.Linq.XDocument
return void
        private void SaveDocument(XDocument document)
        {
            // Sort the elements by path
            var repositoryElements = (from e in GetRepositoryElements(document)
                                      let path = e.GetOptionalAttributeValue("path")
                                      where !String.IsNullOrEmpty(path)
                                      orderby path.ToUpperInvariant()
                                      select e).ToList();

            // Remove all elements
            document.Root.RemoveAll();

            // Re-add them sorted
            repositoryElements.ForEach(e => document.Root.Add(e));

            FileSystem.AddFile(StoreFilePath, document.Save);
        }