/// <summary>
        /// Sets the merchant accounts on the view model or any errors that occurred.
        /// </summary>
        private async Task SetPaymentConfigurations(CheckoutViewModel model)
        {
            var response = await PaymentsApiClient.GetPaymentConfigurations();

            var content = await response.Content.ReadAsStringAsync();

            // Check that the request to get payment configurations was successful.
            if (!response.IsSuccessStatusCode)
            {
                var errorMessage = TryGetErrorMessage(content);

                if (string.IsNullOrWhiteSpace(errorMessage))
                {
                    errorMessage = "The attempt to retrieve payment configurations from Payments API did not succeed and has produced an unexpected error.";
                }

                model.ErrorsViewModel.Errors.Add(new ErrorViewModel
                {
                    Error       = "Payment configurations request error",
                    Description = errorMessage
                });

                return;
            }

            var paymentConfigurationsData = JsonConvert.DeserializeObject <Models.PaymentsApi.PaymentConfigurationsData>(content);

            // Check if there is at least one payment configuration available.
            if (!paymentConfigurationsData.Value.Any())
            {
                model.ErrorsViewModel.Errors.Add(new ErrorViewModel
                {
                    Error       = "Payment configurations not found",
                    Description = "There were no payment configurations returned from Payments API.  " +
                                  "Ensure that there are payment configurations available to the current organization user.  " +
                                  "For the purposes of this sample application you may not use payment configurations that are currently marked with a 'Live' process mode."
                });

                return;
            }

            var validPaymentConfigurations = paymentConfigurationsData.Value.Where(pc => pc.ProcessMode != "Live");

            // Check that at least one payment configuration is valid.
            if (!validPaymentConfigurations.Any())
            {
                model.ErrorsViewModel.Errors.Add(new ErrorViewModel
                {
                    Error       = "Payment configurations not valid ('Live' process mode)",
                    Description = "All payment configurations returned from Payments API are currently marked with a 'Live' process mode.  " +
                                  "For the purposes of this sample application you may not use payment configurations that are currently marked with a 'Live' process mode.  "
                });

                return;
            }

            model.PaymentConfigurations = new SelectList(validPaymentConfigurations, "Id", "Name");
        }