class ReportsService {

	public IncomeVersusExpensesReport incomeVersusExpenses() {
		IncomeVersusExpensesReport report = new IncomeVersusExpensesReport();

		Transactions transactions = transactionsService.retrieve();

		ListMultimap<Long, Transaction> transactionsByMonth = ArrayListMultimap.create();
		for (Transaction transaction : transactions.getTransactions()) {
			Long yearMonth = yearMonth(transaction.getDate());
			transactionsByMonth.put(yearMonth, transaction);
		}
		List<Long> sortedMonths = new ArrayList<>(transactionsByMonth.keySet());
		Collections.sort(sortedMonths);
		for (final Long yearMonth : sortedMonths) {
			String name = monthName(yearMonth);
			report.addMonth(new Month(yearMonth, name, transactionsByMonth.get(yearMonth)));
		}
		return report;
	}

	@Inject  ReportsService(TransactionsService transactionsService);

}