/// <summary>
        /// Harvest bindings.
        /// </summary>
        /// <param name="propertyName">The property name of the bindings property.</param>
        /// <param name="bindingsProperty">The bindings property.</param>
        /// <returns>The harvested bindings.</returns>
        private IIs.WebAddress HarvestBindings(string propertyName, PropertyValueCollection bindingsProperty)
        {
            if (1 == bindingsProperty.Count)
            {
                IIs.WebAddress webAddress = new IIs.WebAddress();

                string[] bindings = ((string)bindingsProperty[0]).Split(":".ToCharArray());

                if (0 < bindings[0].Length)
                {
                    webAddress.IP = bindings[0];
                }

                if (0 < bindings[1].Length)
                {
                    webAddress.Port = bindings[1];
                }

                if (0 < bindings[2].Length)
                {
                    webAddress.Header = bindings[2];
                }

                if ("SecureBindings" == propertyName)
                {
                    webAddress.Secure = IIs.YesNoType.yes;
                }

                return(webAddress);
            }

            return(null);
        }
        /// <summary>
        /// Harvest a web site.
        /// </summary>
        /// <param name="webSiteEntry">The web site directory entry.</param>
        /// <returns>The harvested web site.</returns>
        private IIs.WebSite HarvestWebSite(DirectoryEntry webSiteEntry)
        {
            IIs.WebSite webSite = new IIs.WebSite();

            foreach (string propertyName in webSiteEntry.Properties.PropertyNames)
            {
                PropertyValueCollection property       = webSiteEntry.Properties[propertyName];
                PropertyValueCollection parentProperty = webSiteEntry.Parent.Properties[propertyName];

                if (null == parentProperty.Value || parentProperty.Value.ToString() != property.Value.ToString())
                {
                    switch (propertyName)
                    {
                    case "SecureBindings":
                        IIs.WebAddress secureWebAddress = this.HarvestBindings(propertyName, property);
                        if (null != secureWebAddress)
                        {
                            webSite.AddChild(secureWebAddress);
                        }
                        break;

                    case "ServerBindings":
                        IIs.WebAddress webAddress = this.HarvestBindings(propertyName, property);
                        if (null != webAddress)
                        {
                            webSite.AddChild(webAddress);
                        }
                        break;

                    case "ServerComment":
                        webSite.Description = (string)property.Value;
                        break;
                    }
                }
            }

            foreach (DirectoryEntry childEntry in webSiteEntry.Children)
            {
                switch (childEntry.SchemaClassName)
                {
                case "IIsFilters":
                    string loadOrder = (string)childEntry.Properties["FilterLoadOrder"].Value;
                    if (loadOrder.Length > 0)
                    {
                        string[] filterNames = loadOrder.Split(",".ToCharArray());

                        for (int i = 0; i < filterNames.Length; i++)
                        {
                            using (DirectoryEntry webFilterEntry = new DirectoryEntry(String.Concat(childEntry.Path, '/', filterNames[i])))
                            {
                                IIs.WebFilter webFilter = this.HarvestWebFilter(webFilterEntry);

                                webFilter.LoadOrder = (i + 1).ToString(CultureInfo.InvariantCulture);

                                webSite.AddChild(webFilter);
                            }
                        }
                    }
                    break;

                case "IIsWebDirectory":
                    this.HarvestWebDirectory(childEntry, webSite);
                    break;

                case "IIsWebVirtualDir":
                    foreach (string propertyName in childEntry.Properties.PropertyNames)
                    {
                        PropertyValueCollection property = childEntry.Properties[propertyName];

                        switch (propertyName)
                        {
                        case "Path":
                            webSite.Directory = (string)property.Value;
                            break;
                        }
                    }

                    IIs.WebDirProperties webDirProps = this.HarvestWebDirProperties(childEntry);
                    if (null != webDirProps)
                    {
                        webSite.AddChild(webDirProps);
                    }

                    foreach (DirectoryEntry child2Entry in childEntry.Children)
                    {
                        switch (child2Entry.SchemaClassName)
                        {
                        case "IIsWebDirectory":
                            this.HarvestWebDirectory(child2Entry, webSite);
                            break;

                        case "IIsWebVirtualDir":
                            this.HarvestWebVirtualDir(child2Entry, webSite);
                            break;
                        }
                    }
                    break;
                }
            }

            return(webSite);
        }