/// <summary>
        /// Modifies the <see cref="ApmlDocument"/> to match the data source.
        /// </summary>
        /// <param name="resource">The <see cref="ApmlDocument"/> to be filled.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="resource"/> is a null reference (Nothing in Visual Basic).</exception>
        public void Fill(ApmlDocument resource)
        {
            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(resource, "resource");

            //------------------------------------------------------------
            //	Create namespace resolver
            //------------------------------------------------------------
            XmlNamespaceManager manager     = ApmlUtility.CreateNamespaceManager(this.Navigator.NameTable);

            //------------------------------------------------------------
            //	Attempt to fill syndication resource
            //------------------------------------------------------------
            XPathNavigator headNavigator    = this.Navigator.SelectSingleNode("apml:APML/apml:Head", manager);
            if (headNavigator != null)
            {
                resource.Head.Load(headNavigator, this.Settings);
            }

            XPathNavigator bodyNavigator    = this.Navigator.SelectSingleNode("apml:APML/apml:Body", manager);
            if (bodyNavigator != null)
            {
                if (bodyNavigator.HasAttributes)
                {
                    string defaultProfileAttribute  = bodyNavigator.GetAttribute("defaultprofile", String.Empty);
                    if (!String.IsNullOrEmpty(defaultProfileAttribute))
                    {
                        resource.DefaultProfileName = defaultProfileAttribute;
                    }
                }

                XPathNodeIterator profileIterator   = bodyNavigator.Select("apml:Profile", manager);
                if (profileIterator != null && profileIterator.Count > 0)
                {
                    int counter = 0;
                    while (profileIterator.MoveNext())
                    {
                        ApmlProfile profile = new ApmlProfile();
                        counter++;

                        if (profile.Load(profileIterator.Current, this.Settings))
                        {
                            if (this.Settings.RetrievalLimit != 0 && counter > this.Settings.RetrievalLimit)
                            {
                                break;
                            }

                            ((Collection<ApmlProfile>)resource.Profiles).Add(profile);
                        }
                    }
                }

                XPathNodeIterator applicationIterator   = bodyNavigator.Select("apml:Applications/apml:Application", manager);
                if (applicationIterator != null && applicationIterator.Count > 0)
                {
                    while (applicationIterator.MoveNext())
                    {
                        ApmlApplication application = new ApmlApplication();
                        if (application.Load(applicationIterator.Current, this.Settings))
                        {
                            resource.Applications.Add(application);
                        }
                    }
                }
            }

            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(this.Navigator.SelectSingleNode("apml:APML", manager), this.Settings);
            adapter.Fill(resource, manager);
        }