private async Task ExecuteSubmitExpenseCommand() { if (IsBusy) { return; } IsBusy = true; var category = Categories.ElementAt(CategoryIndex); var expense = new Expense { Amount = Amount, CategoryId = category.Id, DateIncurred = Date, SubmittedBy = AppServiceMDC.XamarinForms.Helpers.Settings.UserId }; try { if (!AppServiceMDC.XamarinForms.Helpers.Settings.IsLoggedIn) { await _azureService.Initialize(); var user = await DependencyService.Get <IAuthentication>() .LoginAsync(_azureService.MobileService, MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory); if (user == null) { return; } } await _azureService.AddExpense(expense); await Application.Current.MainPage.Navigation.PopAsync(); } catch (AggregateException ex) { Debug.WriteLine($"Error adding expense: {ex.Message}"); } finally { IsBusy = false; } }