code: function filter (resources, req) {
    util.debug("There are %d resources in %s", resources.length, req.path);
  
    if (resources.length > 0) {
      // If there are query params, then filter the collection by them
      let queryParams = _.filter(req.swagger.params, { in: "query" });
      if (queryParams.length > 0) {
        // Build the filter object
        let filterCriteria = { data: {}};
        queryParams.forEach((param) => {
          if (req.query[param.name] !== undefined) {
            setDeepProperty(filterCriteria.data, param.name, req.query[param.name]);
          }
        });
  
        if (!_.isEmpty(filterCriteria.data)) {
          // Filter the collection
          util.debug("Filtering resources by %j", filterCriteria.data);
          resources = _.filter(resources, filterCriteria);
          util.debug("%d resources matched the filter criteria", resources.length);
        }
      }
    }
  
    return resources;
  }
docs: Filters the given {@link Resource} array, using the "query" params defined in the Swagger API.
  
  @param   {Resource[]}    resources
  @param   {Request}       req
  @returns {Resource[]}