BigDecimal amount = BigDecimal.ZERO;
for (String id : transactions) {
AccountTransaction transaction = AccountTransaction.findAccountTransaction(Long.parseLong(id));
transaction.setReconciled(Boolean.TRUE);
amount = amount.add(transaction.getAmount().abs());
transaction.merge();
}
Subcategory transferCategory = Subcategory.findBySubcategory("category.transfer.out", user);
AccountTransaction transfer = AccountTransaction.createInstance(origin, Payee.findByName(account.getName()), transferCategory, amount, date, null);
transfer.persist();
Subcategory transferInCategory = Subcategory.findBySubcategory("category.transfer.in", user);