public static ViewModelValidationRule CreateRequiredRule()
        {
            ViewModelValidationRule rule = new ViewModelValidationRule("required");
            rule.Params.Add("isRequired", true);

            return rule;
        }
 private void AddValidators()
 {
     IEnumerable<ModelValidator> vals = ModelValidatorProviders.Providers.GetValidators(_modelMetadata, _controllerContext);
     List<ModelClientValidationRule> clientValidators = vals.SelectMany(v => v.GetClientValidationRules()).ToList();
     foreach (ModelClientValidationRule mcvr in clientValidators)
     {
         ViewModelValidationRule rule = new ViewModelValidationRule(mcvr.ValidationType);
         rule.ErrorMessage = mcvr.ErrorMessage;
         foreach (var item in mcvr.ValidationParameters)
         {
             rule.Params.Add(item.Key, item.Value);
         }
         _viewModelMetadata.ValidationRules.Add(rule);
     }
 }