private async Task AddBook(object obj) { var b = (Book)obj; b.AddedBy = UserId; var msg = string.Empty; var manager = new ServiceManager(); //Check to make sure this isn't a duplicate if (manager.BookExists(b)) { return; } if (await _page.DisplayAlert("", $"Add {b.Title} to library?", "Yep", "Nope")) { IsBusy = true; //Save var newBookId = await manager.AddBook(b); if (newBookId > 0) { b.Id = newBookId; DependencyService.Get <IMessage>().ShowSnackbar($"{b.Title} has been added to your Bookshelf"); // SearchResults.Remove(b); var userBooks = await manager.GetAllBooksByUser(UserId); var act = new Activity() { Id = 0, Book = b, UserId = UserId, IsReading = false }; //See if the user has an active book. if (await _page.DisplayAlert("", $"Set this as your current book?", "Yep", "Nope")) { act.IsReading = true; } await _manager.AddActivity(act); await Application.Current.MainPage.Navigation.PopAsync(); } else { DependencyService.Get <IMessage>().ShowSnackbar($"! Could Not Add Book !"); } searchResults.Clear(); searchText = string.Empty; } IsBusy = false; }