@Transactional
  public UserPaymentUI create(UserPaymentUI uiBean) {

    UserPayment newUserPayment = mapper.toPersistenceBean(uiBean);

    if (uiBean.getUserName() == null) {
      return null;
    }

    Customer customer = userRepository.findByUsername(uiBean.getUserName());
    newUserPayment.setCustomer(customer);

    UserPayment saved = repository.save(newUserPayment);
    logger.debug("Added Payment : " + saved);

    return mapper.toUIBean(saved);
  }
  public UserPaymentUI update(UserPaymentUI uiBean) {
    UserPayment existing = repository.findById(uiBean.getId());

    if (existing == null) {
      return null;
    }

    existing.setAmount(uiBean.getAmount());
    existing.setNotes(uiBean.getNotes());

    UserPayment saved = null;

    try {
      saved = repository.save(existing);
    } catch (Exception e) {
      logger.error(e);
    }

    return mapper.toUIBean(saved);
  }