/**
  * Associates the given payment group id with every historical travel expense that represents a
  * corporate card charge on the given document
  *
  * @param document the document to update
  * @param paymentGroupNumber the payment group id to update the historical expenses with
  */
 protected void associatePaymentGroupWithCreditCardData(
     TEMReimbursementDocument document, KualiInteger paymentGroupNumber) {
   for (HistoricalTravelExpense expense : document.getHistoricalTravelExpenses()) {
     if (expense.getCreditCardStagingData() != null) {
       if (StringUtils.equals(
           expense.getCreditCardStagingData().getCreditCardAgency().getTravelCardTypeCode(),
           TemConstants.TRAVEL_TYPE_CORP)) {
         expense.getCreditCardStagingData().setPaymentGroupId(paymentGroupNumber);
         getBusinessObjectService().save(expense.getCreditCardStagingData());
       }
     }
   }
 }
  @Transactional
  protected boolean processCreditCardStagingExpense(CreditCardStagingData creditCard) {
    LOG.info("Creating historical travel expense for credit card: " + creditCard.getId());
    HistoricalTravelExpense expense =
        travelExpenseService.createHistoricalTravelExpense(creditCard);
    businessObjectService.save(expense);

    // Mark as moved to historical
    creditCard.setErrorCode(CreditCardStagingDataErrorCodes.CREDIT_CARD_MOVED_TO_HISTORICAL);
    LOG.info(
        "Finished creating historical travel expense for credit card: "
            + creditCard.getId()
            + " Historical Travel Expense: "
            + expense.getId());
    businessObjectService.save(creditCard);

    return true;
  }