docs: function validateProperties(object, name, required, optional) {
      // validates object properties exist or not
      var properties = _.keys(object);
      var missing = _.difference(required, properties);
      var extra = _.difference(properties, required, optional);
      var errorOrNull = null;
      if (missing.length) {
          errorOrNull = new VError("%s is missing required properties (%j)",
                                 name, missing);
          errorOrNull.missing = missing;
          errorOrNull.required = required;
          errorOrNull.object = object;
      } else if (extra.length) {
          errorOrNull = new VError("%s has extra (unexpected) properties (%j)",
                                 name, extra);
          errorOrNull.extra = extra;
          errorOrNull.required = required;
          errorOrNull.optional = optional;
          errorOrNull.object = object;
      }
      return errorOrNull;
  }