code: function (criteria) {
              var identity = this.identity;
  
              return this.findOne(criteria).then(function (record) {
                  if (!record) {
                      throw new Errors.NotFoundError(
                          'Could not find %s with criteria %j.'.format(
                              pluralize.singular(identity),
                              criteria
                          ), {
                              criteria: criteria,
                              collection: identity
                          });
                  }
  
                  return record;
              });
          }
docs: Find a single document via criteria and resolve it, otherwise
  reject with a NotFoundError.