public async Task <IActionResult> SubmitPayouts() { PayoutBatch payoutBatch = await _context.AddPayoutBatch(GetCurrentPayouts()); if (payoutBatch.PayoutPaypalBatchId == null) { PayPalHttpClient client = _clientFactory.GetClient(); try { await client.AuthorizeAsync(); await client.CreatePayouts(payoutBatch); await _context.SaveChangesAsync(); } catch (Exception e) { return(Json(e.Message)); } } return(View(viewName: "Index", model: new List <UserPayoutVM>())); }