public ArrayList<History> getHistory(String userId, long entryId) { Entry entry = dao.get(entryId); if (entry == null) return null; authorization.expectWrite(userId, entry); List<Audit> list = auditDAO.getAuditsForEntry(entry); ArrayList<History> result = new ArrayList<>(); for (Audit audit : list) { History history = audit.toDataTransferObject(); if (history.isLocalUser()) { history.setAccount( accountController.getByEmail(history.getUserId()).toDataTransferObject()); } result.add(history); } return result; }