//For adding a snaphot inside the selected book private void Button_AddSnapshot(object sender, RoutedEventArgs e) { var selectedBook = bookShelfDataGrid.SelectedItem; UserBook selectedItem = selectedBook as UserBook; string selectedIsbn; string lastPageNumber = lastPageTxt.Text; try { if (!(selectedItem == null || lastPageNumber == null)) { selectedIsbn = selectedItem.Isbn; dynamoDbOperation.AddSnaphot(username, selectedIsbn, int.Parse(lastPageNumber)); lastPageTxt.Text = ""; BooksIntoDataGrid(); } else { MessageBox.Show("Select a Book and enter the Last Read Page Number", "Error !!!!"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error !!!!"); } }