docs: function Validate(params, accepts) {
  
    var validationError = new ValidationError();
    params = params || {};
    accepts = accepts || [];
  
    var performValidator = function(name, val, validatorOpts, validatorName) {
      validatorOpts = validatorOpts || {};
      val = (val === undefined || val === null)? val : val + ''; // validate string only
      
      // if validator is a custom function, then execute it
      // else find cooresponding validator in built in Validator
      if (_.isFunction(validatorOpts)) {
        try {
          var result = validatorOpts(val, params);
          if (result) {
            validationError.add(name, validatorName, result);
          }
        } catch (e) {
          debug('Error: \'%s\' when calling function \'%s\'', e.message, validatorName);
        }
      } else {
  
        if (!validatorOpts) { return; }
        var validator = Validator[validatorName];
        var args = [val];
  
        var message = _.isString(validatorOpts) ? validatorOpts : validatorOpts.message;
  
        // build arguments for validator
        if (validatorOpts && validatorOpts.args) {
          args.push(validatorOpts.args);
          args = _.flatten(args);
        }
  
        if (validator && _.isFunction(validator)) {
          // if validation failed, then add error message
          if (!validator.apply(Validator, args)) {
            validationError.add(name, validatorName, message);
          }
        } else {
          debug('Validator \'%s\' is not defined', validatorName);
        }
      }
    };
  
    _.each(accepts, function(accept) {
      var name = accept.arg;
      var val = params[name];
  
      var validators = _.extend({}, accept.validates);
  
      // copy `required` from accept to validators
      if (accept.hasOwnProperty('required')) {
        validators.required = accept.required;
      }
  
      if (validators && _.isPlainObject(validators)) {
        if (isEmpty(val)) {
          // check if value exists, if not, then check whether the value is required
          if (validators.hasOwnProperty('required')) {
            performValidator(name, val, validators.required, 'required');
          }
        } else {
          // delete `required` validator for latter iteration
          delete validators.required;
          _.each(validators, function(validatorOpts, validatorName) {
            performValidator(name, val, validatorOpts, validatorName);
          });
        }
      }
    });
  
    return validationError;
  }