private void deleteColoringBook() { var selected = coloringBooksLv.SelectedIndices; if (selected.Count == 1) { var selectedIndex = selected[0]; var item = _coloringBookRepo.GetForEdit(_coloringBooksIds[selectedIndex]); if (item == null) { return; } var text = $"Do you really want to delete {item.Name}?"; if (_coloringBookPageRepo.HasPages(item.ID)) { text += " It contains pages!"; } var dialog = new CustomMessageBox("Warning", text); var result = dialog.ShowDialog(); if (result == DialogResult.OK) { _coloringBookPageRepo.DeleteAllPages(item.ID); _coloringBookRepo.Delete(item.ID); reloadColoringBooks(); } } }