{
int startIndex = 0;
Paging paging = new Paging();
selector.setPaging(paging);
ManagedCustomerPage managedCustomerPage;
do {
paging.setStartIndex(startIndex);
paging.setNumberResults(NUMBER_OF_RESULTS);
LOGGER.info("Retrieving next " + NUMBER_OF_RESULTS + " accounts.");
try {
managedCustomerPage = managedCustomerService.get(selector);
accountList.addAll(managedCustomerPage.getEntries());
} catch (ApiException e) {
// Retry Once
managedCustomerPage = managedCustomerService.get(selector);
accountList.addAll(managedCustomerPage.getEntries());
}
LOGGER.info(accountList.size() + " accounts retrieved.");
startIndex = startIndex + NUMBER_OF_RESULTS;
} while (managedCustomerPage.getTotalNumEntries() > startIndex);
}