public void WritePIDDMPUniqueUsers(string appName) { var sourceIndex = _configuration.GetSection("Indices").GetValue <string>(appName); var uniqueUserIndexName = _configuration.GetSection("StatisticsUniqueUsersIndices").GetValue <string>(appName); bool checkIfIndexEmpty = _elasticSearchRepository.IsIndexEmpty(uniqueUserIndexName); if (checkIfIndexEmpty) { _logger.LogInformation("index is empty and thus we load data from start time {Strings.statisticsStartDate}", Strings.StatisticsStartDate); _elasticSearchRepository.CountAndWriteUniqueUsers(sourceIndex, uniqueUserIndexName, DateTime.Parse(Strings.StatisticsStartDate), false); } else { _logger.LogInformation("index is not empty and thus we load data from previous day"); _elasticSearchRepository.CountAndWriteUniqueUsers(sourceIndex, uniqueUserIndexName, DateTime.Now.Date.AddDays(-1), true); } }