private XElement FindEntry(XDocument document, string path) { path = NormalizePath(path); return (from e in GetRepositoryElements(document) let entryPath = NormalizePath(e.GetOptionalAttributeValue("path")) where path.Equals(entryPath, StringComparison.OrdinalIgnoreCase) select e).FirstOrDefault(); }