code: function(attrs, setOptions){
            var model = this;
            var opt = _.extend({}, options, setOptions);
            var validatedAttrs = getValidatedAttrs(model, getOptionsAttrs(options));
            var allAttrs = _.extend({}, validatedAttrs, model.attributes, attrs);
            var flattened = _.extend(flatten(allAttrs), attrs); // allow people to pass in nested attributes
            var changedAttrs = attrs ? flatten(attrs) : flattened;
            var result = validateModel(model, allAttrs, _.pick(flattened, _.keys(validatedAttrs)));
            model._isValid = result.isValid;
  
            // Trigger validated events.
            // Need to defer this so the model is actually updated before
            // the event is triggered.
            _.defer(function() {
              model.trigger('validated', model._isValid, model, result.invalidAttrs);
              model.trigger('validated:' + (model._isValid ? 'valid' : 'invalid'), model, result.invalidAttrs);
            });
  
            // Return any error messages to Backbone, unless the forceUpdate flag is set.
            // Then we do not return anything and fools Backbone to believe the validation was
            // a success. That way Backbone will update the model regardless.
            if (!opt.forceUpdate && _.intersection(_.keys(result.invalidAttrs), _.keys(changedAttrs)).length > 0) {
              return result.invalidAttrs;
            }
          }
docs: This is called by Backbone when it needs to perform validation. You can call it manually without any parameters to validate the entire model.