public long getNumberOfOwnerEntries(String requesterUserEmail, String ownerEmail) { Account account = DAOFactory.getAccountDAO().getByEmail(requesterUserEmail); if (authorization.isAdmin(requesterUserEmail) || account.getEmail().equals(ownerEmail)) { return dao.ownerEntryCount(ownerEmail); } Set<Group> accountGroups = new HashSet<>(account.getGroups()); GroupController controller = new GroupController(); Group everybodyGroup = controller.createOrRetrievePublicGroup(); accountGroups.add(everybodyGroup); return dao.ownerEntryCount(account, ownerEmail, accountGroups); }