code: function sendResponse (req, res, next, dataStore) {
    return function (err, resource) {
      if (!err) {
        util.debug("%s successfully created/edited/deleted", resource.toString());
        res.swagger.lastModified = resource.modifiedOn;
      }
  
      // Set the response body (unless it's already been set by other middleware)
      if (err || res.body) {
        next(err);
      }
      else if (res.swagger.isCollection) {
        // Response body is the entire collection
        dataStore.getCollection(resource.collection, (err, collection) => {
          res.body = _.map(collection, "data");
          next(err);
        });
      }
      else {
        // Response body is the resource that was created/update/deleted
        res.body = resource.data;
        next();
      }
    };
  }
docs: Returns a function that sends the correct response for the operation.
  
  @param   {Request}   req
  @param   {Response}  res
  @param   {function}  next
  @param   {DataStore} dataStore