class FeatureValidator {

  void validateFeatureUpdateThrowing(Feature feature) throws ServiceException {

    if (feature.hasOwner()) {
      validateOwner(feature.getOwner());
    }

    validateKeysThrowing(feature);

    if (OptionType.flag != feature.getOptions().getOption()) {
      validateOptionsHaveIdsThrowing(feature);
    }

    if (OptionType.flag != feature.getOptions().getOption()
        && feature.getOptions().getItemsCount() != 0) {
      // only validate options if they're sent and we're not a flag type
      validateOptionsThrowing(feature.getOptions());

      if (feature.hasNamespaces()) {
        validateNamespaceFeaturesThrowing(feature);
      }
    }
  }

}