// Fetching shipping rates requires communicating with 3rd party shipping servers, so we need to poll until all the rates have been fetched. private void FetchShippingRates() { SampleApplication.GetShippingRates( (shippingRates, response) => { if (response.Status == (int)HttpStatus.Accepted) { // Poll until the server either fails or returns HttpStatus.SC_ACCEPTED pollingHandler.PostDelayed(() => { FetchShippingRates(); }, PollDelay); } else if (response.Status == (int)HttpStatus.Ok) { isFetching = false; OnFetchedShippingRates(shippingRates.ToList()); } else { isFetching = false; // Handle error OnError(response.Reason); } }, error => { isFetching = false; // Handle error OnError(error); }); }