public ActionResult Delete(int id) { Furniture furniture = FurnitureService.GetById(id); List <Image> images = furniture.Images.ToList(); foreach (int imageId in images.Select(x => x.ImageId)) { Image image = ImageService.GetById(imageId); ImageService.Delete(image); } FurnitureService.Delete(furniture); return(RedirectToAction("Index")); }