public void DeleteBook(string id) { var book = GetBookById(id); var publicationInPublisihngHouses = _publicationInPublisihngHouses.Where(x => x.Publication.Id == book.Publication.Id).ToList(); foreach (var publicationInPublisihngHouse in publicationInPublisihngHouses) { _publicationInPublisihngHouseRepository.Delete(publicationInPublisihngHouse.Id); _publicationInPublisihngHouseRepository.Save(); } _publicationRepository.Delete(book.Publication.Id); _publicationRepository.Save(); _bookRepository.Delete(id); _bookRepository.Save(); }