code: function(req) {
  
  
      // handle add/remove routes that have :parentid as the primary key field
      var originalId;
      if (req.params.parentid) {
        originalId = req.params.id;
        req.params.id = req.params.parentid;
      }
  
      return new Promise(function(resolve, reject) {
          sails.hooks.blueprints.middleware.find(req, {
            ok: resolve,
            serverError: reject,
            // this isn't perfect, since it returns a 500 error instead of a 404 error
            // but it is better than crashing the app when a record doesn't exist
            notFound: reject
          });
        })
        .then(function(result) {
          if (originalId !== undefined) {
            req.params.id = originalId;
          }
          return result;
        });
    }
docs: Find objects that some arbitrary action would be performed on, given the
  same request.
  
  @param options.model
  @param options.query
  
  TODO this will be less expensive when waterline supports a caching layer