public static void AddModelErrors(this ModelStateDictionary modelState, List<Models.BrokenRule> brokenRules)
 {
     if (brokenRules.IsNotNullOrEmpty())
     {
         foreach (var item in brokenRules)
         {
             foreach (var error in item.ErrorList)
             {
                 modelState.AddModelError(item.PropertyName, error);
             }
         }
     }
 }
        /// <summary>
        /// Shows the product list view.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="productCount">The product count.</param>
        /// <param name="sort">The sort.</param>
        /// <returns></returns>
        // [ActionFilters.PartialRenderActionFilter(Order = 1)]
        // [ActionFilters.CacheActionFilter(CacheKey = "ProductList", Duration = 3600, Order = 2, VaryByParam="*")]
        public ActionResult ShowProductListView(Models.ProductListType type, string viewName, int? productCount, List<Models.SortProductList> sort)
        {
            var key = string.Format("ShowProductListView|{0}|{1}", type, productCount.GetValueOrDefault(int.MaxValue));
            var list = CacheService[key] as IList<Models.Product>;

            if (list == null)
            {
                var filter = CatalogService.CreateProductListFilter(HttpContext);
                filter.ListType = type;

                int count = 0;
                if (sort.IsNotNullOrEmpty())
                {
                    foreach (var item in sort)
                    {
                        filter.SortList.Add(item);
                    }
                }
                list = CatalogService.GetProductListBySearch(filter, 0, productCount.GetValueOrDefault(int.MaxValue), out count);
                CacheService.Add(key, list, DateTime.Now.AddHours(1));
            }

            var user = User.GetUserPrincipal();
            CatalogService.ApplyBestPrice(list, user.CurrentUser);
            // var result = new Models.ProductList(list);

            return PartialView(viewName, list);
        }