public void DeletePhoto(int photoId) { var photo = _aquariumDao.GetPhoto(photoId); _aquariumDao.DeletePhoto(photoId); var path = photo.Filepath; var basePath = Path.GetDirectoryName(path); var filename = Path.GetFileName(path); var sizes = _config.GetSection("Photos:Sizes").Get <List <decimal> >(); foreach (var s in sizes) { var destination = Path.GetDirectoryName(path) + "/x" + s + "/" + filename; _azureService.DeleteFileFromStorageContainer(destination); } _azureService.DeleteFileFromStorageContainer(path); }