public virtual UrlPropertyModel GetPropertyModel(Type type)
        {
            UrlPropertyModel result = new UrlPropertyModel();
            PropertyInfo[] propertyInfos = type.GetProperties();

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                if (propertyInfo.GetCustomAttributes(typeof (UrlAttribute), true).Any() &&
                    propertyInfo.PropertyType == typeof(string) &&
                    propertyInfo.CanRead &&
                    propertyInfo.CanWrite)
                {
                    result.UrlProperties.Add(propertyInfo);
                }
                else if (typeof(IEnumerable).IsAssignableFrom(propertyInfo.PropertyType) && propertyInfo.CanRead)
                {
                    result.EnumerableProperties.Add(propertyInfo);

                }
                else if (propertyInfo.PropertyType.IsClass && propertyInfo.PropertyType != typeof(string) && propertyInfo.CanRead)
                {
                    result.ClassProperties.Add(propertyInfo);
                }
            }

            return result;
        }
        public virtual UrlPropertyModel GetPropertyModel(Type type)
        {
            UrlPropertyModel result = new UrlPropertyModel();

            PropertyInfo[] propertyInfos = type.GetProperties();

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                if (propertyInfo.GetCustomAttributes(typeof(UrlAttribute), true).Any() &&
                    propertyInfo.PropertyType == typeof(string) &&
                    propertyInfo.CanRead &&
                    propertyInfo.CanWrite)
                {
                    result.UrlProperties.Add(propertyInfo);
                }
                else if (typeof(IEnumerable).IsAssignableFrom(propertyInfo.PropertyType) && propertyInfo.CanRead)
                {
                    result.EnumerableProperties.Add(propertyInfo);
                }
                else if (propertyInfo.PropertyType.IsClass && propertyInfo.PropertyType != typeof(string) && propertyInfo.CanRead)
                {
                    result.ClassProperties.Add(propertyInfo);
                }
            }


            return(result);
        }
        public void ValidateUrls(HttpContextBase httpContext, object item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            UrlPropertyModel urlPropertyModel = GetPropertyModel(item.GetType());
            Lazy <string>    baseUrlProvider  = new Lazy <string>(() => _baseUrlProvider.GetBaseUrl(httpContext));

            foreach (PropertyInfo urlProperty in urlPropertyModel.UrlProperties)
            {
                CheckForAbsoluteUrl(item, urlProperty, baseUrlProvider);
            }

            foreach (PropertyInfo classProperty in urlPropertyModel.ClassProperties)
            {
                object value = classProperty.GetValue(item, null);
                if (value != null)
                {
                    ValidateUrls(httpContext, value);
                }
            }

            foreach (PropertyInfo enumerableProperty in urlPropertyModel.EnumerableProperties)
            {
                IEnumerable value = enumerableProperty.GetValue(item, null) as IEnumerable;
                if (value != null)
                {
                    foreach (object obj in value)
                    {
                        ValidateUrls(httpContext, obj);
                    }
                }
            }
        }