// TODO EntityBuilder ??? private Operation buildOperation(User user, String description, Double amount) { Operation operation = new Operation(); operation.setUser(user); Set<Account> accounts = user.getAccounts(); Account account = null; Iterator<Account> iterator = accounts.iterator(); while (iterator.hasNext()) { account = iterator.next(); } operation.setAccount(account); operation.setAmount(amount); operation.setDescription(description); operation.setDate(Calendar.getInstance()); return operation; }