private static XElement GetMetadataElement(XDocument document) { // Get the metadata element this way so that we don't have to worry about the schema version XName metadataName = XName.Get("metadata", document.Root.Name.Namespace.NamespaceName); return document.Root.Element(metadataName); }