private async void SaveDetailsAsync() { IsLoading = true; // Show a progress dialog. var progressDialog = _dialogService.ShowProgress("Please wait...", "The details are being saved to your Office 365 tenant."); if (IsExisting) { // Calculate address (range). const int startRow = 2; var endRow = 2 + (_configService.DataFile.PropertyTable.Rows.Length - 1); var address = $"{Constants.DataFilePropertyTableColumnStart}{startRow}:" + $"{Constants.DataFilePropertyTableColumnEnd}{endRow}"; // Update the table row. await _graphService.UpdateGroupTableRowsAsync(_configService.AppGroup, _configService.DataFile.DriveItem, Constants.DataFileDataSheet, address, _configService.DataFile.PropertyTable.Rows.Cast <TableRowModel>().ToArray()); } else { // Create property group. var mailNickname = new string(_streetName.ToCharArray() .Where(char.IsLetterOrDigit) .ToArray()) .ToLower(); var propertyGroup = await _graphService.AddGroupAsync(GroupModel.CreateUnified( StreetName, Details.Description, mailNickname)); // Add the current user as a member of the app group. await _graphService.AddGroupUserAsync(propertyGroup, _configService.User); // We need the file storage to be ready in order to place any files. // Wait for it to be configured. await _graphService.WaitForGroupDriveAsync(propertyGroup); // Add details to data file. Details.Id = propertyGroup.Mail; await _graphService.AddGroupTableRowAsync(_configService.AppGroup, _configService.DataFile.DriveItem, Constants.DataFilePropertyTable, Details); // Add group and details to local config. _configService.Groups.Add(propertyGroup); _configService.DataFile.PropertyTable.AddRow(Details); } // Close the progress dialog. progressDialog.Close(); IsLoading = false; GoBackCommand.Execute(null); }