private void addAcceptedPaymentTypeForATransaction(
      List<AcceptedPaymentType> addAcceptedPaymentTypes, TrxnTypes transactionType)
      throws Exception {

    for (TransactionAcceptedPaymentTypes transactionAcceptedPaymentTypes :
        currentAcceptedPaymentTypes) {
      TrxnTypes transType = transactionAcceptedPaymentTypes.getTransactionType();
      if (transType.equals(transactionType)) {
        List<AcceptedPaymentType> paymentTypes = GetSavePaymentTypes(transType);
        List<AcceptedPaymentType> acceptedPaymentTypes =
            transactionAcceptedPaymentTypes.getAcceptedPaymentTypes();
        if ((acceptedPaymentTypes != null) && (acceptedPaymentTypes.size() > 0)) {
          for (PaymentTypes paymentType : PaymentTypes.values()) {
            if (Find(paymentType, acceptedPaymentTypes) == false) {
              AcceptedPaymentType acceptedPaymentType = new AcceptedPaymentType();
              Short paymentTypeId = paymentType.getValue();
              PaymentTypeEntity paymentTypeEntity = new PaymentTypeEntity(paymentTypeId);
              acceptedPaymentType.setPaymentTypeEntity(paymentTypeEntity);
              TransactionTypeEntity transactionEntity = new TransactionTypeEntity();
              transactionEntity.setTransactionId(transType.getValue());
              acceptedPaymentType.setTransactionTypeEntity(transactionEntity);
              addAcceptedPaymentTypes.add(acceptedPaymentType);
              paymentTypes.add(acceptedPaymentType);
            }
          }
        }
      }
    }
  }
 private boolean Find(PaymentTypes paymentType, List<AcceptedPaymentType> acceptedPaymentTypes) {
   for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypes) {
     if (acceptedPaymentType.getPaymentTypeEntity().getId().shortValue()
         == paymentType.getValue().shortValue()) {
       return true;
     }
   }
   return false;
 }