/**
   * Persists that passed {@link UdaDefinition} and checks the business key uniqueness.
   *
   * @param def the {@link UdaDefinition} to persist
   * @throws NonUniqueBusinessKeyException in case a {@link UdaDefinition} with the same id and
   *     target type exist for the owning {@link Organization}
   */
  void createDefinition(UdaDefinition def) throws NonUniqueBusinessKeyException {

    try {
      ds.persist(def);
    } catch (NonUniqueBusinessKeyException e) {
      logger.logWarn(
          Log4jLogger.SYSTEM_LOG,
          e,
          LogMessageIdentifier.WARN_NON_UNIQUE_BUSINESS_KEY_UDA_DEFINITION);
      ctx.setRollbackOnly();
      throw e;
    }
  }
 private static SupportedCurrency persistCurrency(DataService mgr, String currencyCode)
     throws NonUniqueBusinessKeyException {
   SupportedCurrency currency = new SupportedCurrency(currencyCode);
   mgr.persist(currency);
   return currency;
 }