/// <summary>
        /// Returns the PageDataCollection which the PageReferenceCollection represents.
        /// Any non resolvable references will be skipped without errors.
        /// </summary>
        /// <param name="references"></param>
        /// <returns></returns>
        public static PageDataCollection ToPageDataCollection(this PageReferenceCollection references)
        {
            var retval = new PageDataCollection();

            if (references != null)
                foreach (PageReference reference in references)
                    retval.AddIfResolvable(reference);

            return retval;
        }
        /// <summary>
        /// Returns a <see cref="PageDataCollection"/> with the links that resolve to EPiServer pages.
        /// Other links are dropped without error.
        /// </summary>
        /// <param name="linkItemCollection"></param>
        /// <returns></returns>
        public static PageDataCollection ToPageDataCollection(this LinkItemCollection linkItemCollection)
        {
            var retval = new PageDataCollection();

            if (linkItemCollection != null)
                foreach (var linkItem in linkItemCollection)
                {
                    var url = new UrlBuilder(linkItem.Href);

                    if (PermanentLinkMapStore.ToMapped(url))
                        retval.AddIfResolvable(PermanentLinkUtility.GetPageReference(url));
                }

            return retval;
        }