private async void RemoveNote_FromCollection(object sender) { if (sender != null) { var id = sender as string; //Add Notes to Server Animate = true; Instructions = "Deleting Note"; //Diagnostics string Message = string.Empty; string StackTrace = string.Empty; bool _HasError = false; //Remove note await Task.Run(() => { try { this.Notes.RemoveAt(this.Notes.IndexOf(this.Notes.SingleOrDefault(w => w.ID == id))); _notesManager.Delete_NoteById(id); DataVaultWebServiceClient dataService = new DataVaultWebServiceClient(ConfigurationManager.InSecurePublicBinding(), new System.ServiceModel.EndpointAddress(Constants.Data_InSecureUrl)); var response = dataService._DeleteNote_ByID(id, Constants.InMemory_ContactID); if (response.Errors.Count != 0) { response.Errors.ForEach(w => { //Add to log table for diagnostics if (this.logging != null) { var log = LocalMapper.Map_LogWithMessage(w, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); this.logging.AddLog(log); } }); _HasError = true; } } catch (Exception ex) { _HasError = true; if (ex.InnerException != null) { Message = ex.InnerException.Message; StackTrace = ex.InnerException.StackTrace; } else { Message = ex.Message; StackTrace = ex.StackTrace; } var mEx = new Exceptions(logging, Message, StackTrace); if (mEx != null) { mEx.HandleException(mEx, logging); } } }).ContinueWith((e) => { Device.BeginInvokeOnMainThread(() => { Animate = false; //if (_HasError) // dialogue.ShowAlert("mmm...Something went wrong", Message); }); }); } }