private void UpdateFlags()
        {
            if (ClinicalDetails.IsSymptomatic == false)
            {
                ClinicalDetails.SymptomStartDate = null;
                FormattedSymptomDate             = ClinicalDetails.SymptomStartDate.ConvertToFormattedDate();
                ModelState.Remove("ClinicalDetails.SymptomStartDate");
            }

            if (ClinicalDetails.StartedTreatment == false)
            {
                ClinicalDetails.TreatmentStartDate = null;
                FormattedTreatmentDate             = ClinicalDetails.TreatmentStartDate.ConvertToFormattedDate();
                ModelState.Remove("ClinicalDetails.TreatmentStartDate");
            }

            if (ClinicalDetails.BCGVaccinationState != Status.Yes)
            {
                ClinicalDetails.BCGVaccinationYear = null;
                ModelState.Remove("ClinicalDetails.BCGVaccinationYear");
            }

            if (ClinicalDetails.TreatmentRegimen != TreatmentRegimen.Other)
            {
                ClinicalDetails.TreatmentRegimenOtherDescription = null;
                ModelState.Remove("ClinicalDetails.TreatmentRegimenOtherDescription");
            }

            if (!NotificationSiteMap.ContainsKey(SiteId.OTHER) || !NotificationSiteMap[SiteId.OTHER])
            {
                OtherSite = null;
                ModelState.Remove("OtherSite.SiteDescription");
            }

            if (ClinicalDetails.HomeVisitCarriedOut != Status.Yes)
            {
                ClinicalDetails.FirstHomeVisitDate = null;
                FormattedHomeVisitDate             = ClinicalDetails.FirstHomeVisitDate.ConvertToFormattedDate();
                ModelState.Remove("ClinicalDetails.FirstHomeVisitDate");
            }

            if (ClinicalDetails.HealthcareSetting != HealthcareSetting.Other)
            {
                ClinicalDetails.HealthcareDescription = null;
            }

            if (ClinicalDetails.IsDotOffered != Status.Yes)
            {
                ClinicalDetails.DotStatus = null;
            }

            if (ClinicalDetails.EnhancedCaseManagementStatus != Status.Yes)
            {
                ClinicalDetails.EnhancedCaseManagementLevel = 0;
            }
        }
        protected override async Task <IActionResult> PrepareAndDisplayPageAsync(bool isBeingSubmitted)
        {
            ClinicalDetails = Notification.ClinicalDetails;
            await SetNotificationProperties(isBeingSubmitted, ClinicalDetails);

            var notificationSites = Notification.NotificationSites;

            notificationSites.ForEach(x => x.ShouldValidateFull = Notification.ShouldValidateFull);

            SetupNotificationSiteMap(notificationSites);
            OtherSite = new NotificationSite
            {
                SiteId             = (int)SiteId.OTHER,
                SiteDescription    = notificationSites.FirstOrDefault(ns => ns.SiteId == (int)SiteId.OTHER)?.SiteDescription,
                ShouldValidateFull = Notification.ShouldValidateFull
            };
            Sites = (await _referenceDataRepository.GetAllSitesAsync()).ToList();

            PatientBirthYear = Notification.PatientDetails.Dob?.Year;

            FormattedSymptomDate               = ClinicalDetails.SymptomStartDate.ConvertToFormattedDate();
            FormattedFirstPresentationDate     = ClinicalDetails.FirstPresentationDate.ConvertToFormattedDate();
            FormattedTbServicePresentationDate = ClinicalDetails.TBServicePresentationDate.ConvertToFormattedDate();
            FormattedDiagnosisDate             = ClinicalDetails.DiagnosisDate.ConvertToFormattedDate();
            FormattedTreatmentDate             = ClinicalDetails.TreatmentStartDate.ConvertToFormattedDate();
            FormattedMdrTreatmentDate          = ClinicalDetails.MDRTreatmentStartDate.ConvertToFormattedDate();
            FormattedHomeVisitDate             = ClinicalDetails.FirstHomeVisitDate.ConvertToFormattedDate();

            if (ClinicalDetails.ShouldValidateFull)
            {
                TryValidateModel(this);

                // EditPageErrorDictionary is null only if coming from a GET call, we want to guard here
                // only in a GET call
                if (EditPageErrorDictionary == null &&
                    (!NotificationSiteMap.ContainsKey(SiteId.OTHER) || !NotificationSiteMap[SiteId.OTHER]))
                {
                    ModelState.Remove("OtherSite.SiteDescription");
                }
            }

            return(Page());
        }