public void DeleteById(Guid artistId) { var artist = this.artistRepository.GetById(artistId); var dateDeleted = this.dateTimeProvider.Now(); if (artist.Albums.Count > 0) { foreach (var album in artist.Albums) { albumService.DeleteById(album.Id); } } if (artist != null) { artist.IsDeleted = true; artist.DeletedOn = this.dateTimeProvider.Now(); this.artistRepository.Update(artist); this.unitOfWork.Commit(); } }