private void downloadTransactions(int level, String endDate) {
        Map<Integer,String> codeLookup = new HashMap<Integer,String>();
        for (Account a : mongoDao.getAccounts()) {
            codeLookup.put(a.getId(), a.getCode());
        }
        try {
            accountService.clearTotals();
            Object objects = accountService.download(endDate);
            if (objects==null) throw new IOException("null pointer");
            if(!List.class.isAssignableFrom(objects.getClass())) throw new IOException("response parse error");
            //logger.log(Level.INFO, "Result size: {0}", ((List)objects).size());
            for (Object o : (List)objects) {
                if (o == null || !Transaction.class.isAssignableFrom(o.getClass()))
                    throw new RuntimeException("Got "+o.getClass().getName()+" instead of Transaction");
                Transaction t = (Transaction)o;
                //logger.info(t.toString());
                Thread.sleep(50);
                accountService.reckon(level, codeLookup.get(t.getAccount_id()), t.getAmount());
            }
        }
        catch (Exception ex) {
            logger.log(Level.SEVERE, null, ex);
            //ex.printStackTrace();
            error = ex.getClass().getName() +" : "+ex.getMessage();
            return;
        }
        message = "downloaded transactions";
    }