class DataManager {

    public Single<AccountData> getAccountDetails() {
        return getAccounts()
                .flatMap(new Func1<AccountsResponse, Single<? extends AccountData>>() {
                    @Override
                    public Single<? extends AccountData> call(AccountsResponse accountsResponse) {
                        if (!accountsResponse.accounts.isEmpty()) {
                            String accountId = accountsResponse.accounts.get(0).id;
                            return Single.zip(getBalance(accountId), getTransactions(accountId),
                                    new Func2<Balance, List<Transaction>, AccountData>() {
                                @Override
                                public AccountData call(Balance balance,
                                                        List<Transaction> transactions) {
                                    return new AccountData(balance, transactions);
                                }
                            });
                        }
                        return Single.just(new AccountData());
                    }
                });
    }

    @Inject public  DataManager(MondroidService mondroidService, PreferencesHelper preferencesHelper);

}