public override async void Initialize(INavigationParameters parameters)
        {
            base.Initialize(parameters);

            try
            {
                loggerService.StartMethod();

                var exposureRiskCalculationConfiguration
                    = await _exposureRiskCalculationConfigurationRepository.GetExposureRiskCalculationConfigurationAsync(preferCache : true);

                loggerService.Info(exposureRiskCalculationConfiguration.ToString());

                var userExposureInformationList = _exposureDataRepository.GetExposureInformationList(AppConstants.TermOfExposureRecordValidityInDays);

                string contactedNotifyPageCountFormat = AppResources.ContactedNotifyPageCountOneText;
                if (userExposureInformationList.Count() > 1)
                {
                    contactedNotifyPageCountFormat = AppResources.ContactedNotifyPageCountText;
                }

                var dailySummaryList = await _exposureDataRepository.GetDailySummariesAsync(AppConstants.TermOfExposureRecordValidityInDays);

                var dailySummaryMap    = dailySummaryList.ToDictionary(ds => ds.GetDateTime());
                var exposureWindowList = await _exposureDataRepository.GetExposureWindowsAsync(AppConstants.TermOfExposureRecordValidityInDays);

                int  dayCount = 0;
                long exposureDurationInSec = 0;
                foreach (var ew in exposureWindowList.GroupBy(exposureWindow => exposureWindow.GetDateTime()))
                {
                    if (!dailySummaryMap.ContainsKey(ew.Key))
                    {
                        loggerService.Warning($"ExposureWindow: {ew.Key} found, but that is not contained the list of dailySummary.");
                        continue;
                    }

                    var dailySummary = dailySummaryMap[ew.Key];

                    RiskLevel riskLevel = _exposureRiskCalculationService.CalcRiskLevel(dailySummary, ew.ToList(), exposureRiskCalculationConfiguration);
                    if (riskLevel >= RiskLevel.High)
                    {
                        exposureDurationInSec += ew.Sum(e => e.ScanInstances.Sum(s => s.SecondsSinceLastScan));
                        dayCount += 1;
                    }
                }

                string contactedNotifyPageExposureDurationFormat = AppResources.ContactedNotifyPageExposureDurationOne;
                if (dayCount > 1)
                {
                    contactedNotifyPageExposureDurationFormat = AppResources.ContactedNotifyPageExposureDuration;
                }
                TimeSpan timeSpan     = TimeSpan.FromSeconds(exposureDurationInSec);
                var      totalMinutes = Math.Ceiling(timeSpan.TotalMinutes);

                if (userExposureInformationList.Count() > 0 && dayCount > 0)
                {
                    // Show Headers
                    var beforeDateMillisSinceEpoch = userExposureInformationList.Max(ei => ei.Timestamp.ToUnixEpochMillis());
                    var afterDateMillisSinceEpoch  = dailySummaryList.Min(ds => ds.DateMillisSinceEpoch);

                    var beforeDate = DateTimeOffset.UnixEpoch.AddMilliseconds(beforeDateMillisSinceEpoch).UtcDateTime;
                    var afterDate  = DateTimeOffset.UnixEpoch.AddMilliseconds(afterDateMillisSinceEpoch).UtcDateTime;

                    ExposureCount = string.Format(AppResources.ContactedNotifyPageCountHeader, beforeDate.ToString("D")) + "\n"
                                    + string.Format(contactedNotifyPageCountFormat, userExposureInformationList.Count());
                    ExposureDurationInMinutes = string.Format(AppResources.ContactedNotifyPageExposureDurationHeader, afterDate.ToString("D")) + "\n"
                                                + string.Format(contactedNotifyPageExposureDurationFormat, dayCount, totalMinutes);
                }
                else if (exposureDurationInSec > 0)
                {
                    ExposureDurationInMinutes = string.Format(contactedNotifyPageExposureDurationFormat, dayCount, totalMinutes);
                }
                else if (userExposureInformationList.Count() > 0)
                {
                    ExposureCount = string.Format(contactedNotifyPageCountFormat, userExposureInformationList.Count());
                }
            }
            catch (Exception exception)
            {
                loggerService.Exception("Failed to Initialize", exception);
            }
            finally
            {
                loggerService.EndMethod();
            }
        }
        public async Task InitExposures()
        {
            var exposures = new ObservableCollection <ExposureSummary>();

            var exposureRiskCalculationConfiguration
                = await _exposureRiskCalculationConfigurationRepository.GetExposureRiskCalculationConfigurationAsync(preferCache : false);

            _loggerService.Info(exposureRiskCalculationConfiguration.ToString());

            var dailySummaryList
                = await _exposureDataRepository.GetDailySummariesAsync(AppConstants.TermOfExposureRecordValidityInDays);

            var dailySummaryMap = dailySummaryList.ToDictionary(ds => ds.GetDateTime());

            var exposureWindowList
                = await _exposureDataRepository.GetExposureWindowsAsync(AppConstants.TermOfExposureRecordValidityInDays);

            var userExposureInformationList
                = _exposureDataRepository.GetExposureInformationList(AppConstants.TermOfExposureRecordValidityInDays);

            if (dailySummaryList.Count() > 0)
            {
                foreach (var ew in exposureWindowList.GroupBy(exposureWindow => exposureWindow.GetDateTime()))
                {
                    if (!dailySummaryMap.ContainsKey(ew.Key))
                    {
                        _loggerService.Warning($"ExposureWindow: {ew.Key} found, but that is not contained the list of dailySummary.");
                        continue;
                    }

                    var dailySummary = dailySummaryMap[ew.Key];

                    RiskLevel riskLevel = _exposureRiskCalculationService.CalcRiskLevel(
                        dailySummary,
                        ew.ToList(),
                        exposureRiskCalculationConfiguration
                        );
                    if (riskLevel < RiskLevel.High)
                    {
                        continue;
                    }

                    var ens = new ExposureSummary()
                    {
                        Timestamp    = ew.Key,
                        ExposureDate = IExposureDataRepository.ConvertToTerm(dailySummary.GetDateTime()),
                    };
                    var exposureDurationInSec = ew.Sum(e => e.ScanInstances.Sum(s => s.SecondsSinceLastScan));
                    ens.SetExposureTime(exposureDurationInSec);

                    exposures.Add(ens);
                }
            }

            if (userExposureInformationList.Count() > 0)
            {
                foreach (var ei in userExposureInformationList.GroupBy(userExposureInformation => userExposureInformation.Timestamp))
                {
                    var ens = new ExposureSummary()
                    {
                        Timestamp    = ei.Key,
                        ExposureDate = IExposureDataRepository.ConvertToTerm(ei.Key),
                    };
                    ens.SetExposureCount(ei.Count());
                    exposures.Add(ens);
                }
            }

            Exposures.Clear();
            foreach (var exposure in exposures.OrderByDescending(exposureSummary => exposureSummary.Timestamp))
            {
                Exposures.Add(exposure);
            }
        }