ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Validators/ValidatorUtilities.cs
using Grand.Web.Areas.Admin.Models.Settings;
using System.Linq;

namespace Grand.Web.Areas.Admin.Validators
{
    public static class ValidatorUtilities
    {
        public static bool PageSizeOptionsInAdvancedSettingsValidator(SettingModel model, string value)
        {
            if (model.Name.ToLower().Contains("pagesizeoptions"))
            {
                if (string.IsNullOrEmpty(value))
                {
                    return false;
                }

                var notValid = value.Split(',').Select(p => p.Trim()).GroupBy(p => p).Any(p => p.Count() > 1);
                return !notValid;
            }
            return true;
        }
    }
}