private static XmlElementEx GetConnectionStringsElement(XmlDocumentEx webConfig)
        {
            var webRootPath = Path.GetDirectoryName(webConfig.FilePath);
              XmlElement configurationNode = webConfig.SelectSingleNode(WebConfig.ConfigurationXPath) as XmlElement;
              Assert.IsNotNull(configurationNode,
            "The {0} element is missing in the {1} file".FormatWith("/configuration", webConfig.FilePath));
              XmlElement webConfigConnectionStrings = configurationNode.SelectSingleNode("connectionStrings") as XmlElement;
              Assert.IsNotNull(webConfigConnectionStrings,
            "The web.config file doesn't contain the /configuration/connectionStrings node");
              XmlAttribute configSourceAttribute = webConfigConnectionStrings.Attributes[WebConfig.ConfigSourceAttributeName];
              if (configSourceAttribute != null)
              {
            string configSourceValue = configSourceAttribute.Value;
            if (!string.IsNullOrEmpty(configSourceValue) && !string.IsNullOrEmpty(webRootPath))
            {
              string filePath = Path.Combine(webRootPath, configSourceValue);
              if (FileSystem.FileSystem.Local.File.Exists(filePath))
              {
            XmlDocumentEx connectionStringsConfig = XmlDocumentEx.LoadFile(filePath);
            XmlElement connectionStrings = connectionStringsConfig.SelectSingleNode("/connectionStrings") as XmlElement;
            if (connectionStrings != null)
            {
              return new XmlElementEx(connectionStrings, connectionStringsConfig);
            }
              }
            }
              }

              return new XmlElementEx(webConfigConnectionStrings, webConfig);
        }
        public static XmlElement GetPipelines(XmlDocumentEx document)
        {
            Assert.ArgumentNotNull(document, "document");

              XmlElement pipelinesNode = document.SelectSingleNode("configuration/pipelines") as XmlElement;
              Assert.IsNotNull(pipelinesNode, "Can't find pipelines configuration node");

              return pipelinesNode;
        }