docs: function validateRequestParams(req, resource, method, adapter) {
          req = req || {};
  
          var params = resource.params || {};
          var methodParams = _.extend({}, params[method], params[adapter + '.' + method] );
          var requiredParams = methodParams.required || [];
          var eitherorParams = methodParams.eitheror || [];
          var optional = methodParams.optional || [];
          var eitherorExists, param;
          var err, reqObj;
  
          // make sure all the required params are there
          for (var i = 0; i < requiredParams.length; i++) {
              param = requiredParams[i];
  
              if (req[param] === undefined || req[param] === null) {
                  reqObj = _.extend({}, req);
                  delete reqObj.resource;
                  err = new Error('Invalid request');
                  err.code = 'invalid_request_error';
                  err.message = resource.name + ' ' + method + ' missing ' + param +
                      '. Required params: ' + JSON.stringify(requiredParams) +
                      ' req is: ' + JSON.stringify(reqObj);
                  return Q.reject(err);
              }
          }
  
          // make sure at least one of the eitheror params are there
          if (eitherorParams.length) {
              eitherorExists = false;
  
              _.each(eitherorParams, function (eitherorParam) {
                  if (req[eitherorParam]) { eitherorExists = true; }
              });
  
              if (!eitherorExists) {
                  delete req.caller;
                  delete req.resource;
                  err = new Error('Invalid request');
                  err.code = 'invalid_request_error';
                  err.message = resource.name + ' ' + method +
                      ' must have one of the following params: ' + JSON.stringify(eitherorParams) +
                      ' request is ' + JSON.stringify(req);
                  return Q.reject(err);
              }
          }
  
          // now loop through the values and error if invalid param in there; also do JSON parsing if an object
          var validParams = requiredParams.concat(eitherorParams, optional,
              ['lang', 'caller', 'resource', 'method', 'auth', 'noemit']);
          for (var key in req) {
              if (req.hasOwnProperty(key)) {
                  if (validParams.indexOf(key) < 0) {
                      delete req.caller;
                      delete req.resource;
                      err = new Error('Invalid request');
                      err.code = 'invalid_request_error';
                      err.message = 'For ' + resource.name + ' ' + method + ' the key ' +
                          key + ' is not allowed. Valid params: ' + JSON.stringify(validParams) +
                          ' request is ' + JSON.stringify(req);
                      return Q.reject(err);
                  }
              }
          }
  
          // no errors, so return resolved promise
          return new Q();
      }