public async Task SaveClustersAsync() { var trainSamples = await _samplesService.GetTrainPhotosAsync(); var clusters = await BuildClustersAsync(_numberOfClusters, trainSamples); await _clusterSamplePhotoRepository.DeleteAsync(x => true); await _clusterRepository.DeleteAsync(x => true); foreach (var cluster in clusters) { await _clusterRepository.CreateAsync(cluster); } _logger.LogInfo("Old clusters removed and new clusters added."); }