/**
         * Record the milestone BinaryAnswer for the given milestone ID and then remove it from the unanswered milestones list.
         */
        public void RemoveFromVaccinationHistory(int vaccineID)
        {
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            Vaccine vaccine = vaccineDatabaseAccess.GetVaccineSync(vaccineID);

            VaccinationHistory.RemoveFromVaccineHistory(vaccineID);
            Boolean vaccineAddedToUnanswered = UnansweredVaccinations.AddVaccination(vaccine);

            vaccineDatabaseAccess.CloseSyncConnection();
        }
        /**
         * Record the milestone BinaryAnswer for the given milestone ID and then remove it from the unanswered milestones list.
         */
        public void AddOrUpdateVaccinationHistory(int vaccineID)
        {
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            Vaccine vaccine = vaccineDatabaseAccess.GetVaccineSync(vaccineID);

            VaccinationHistory.UpdateOrInsertToVaccineHistory(vaccineID);
            Boolean vaccineRemovedFromUnanswered = UnansweredVaccinations.RemoveVaccination(vaccine);

            vaccineDatabaseAccess.CloseSyncConnection();
        }
        // Removal takes O(n) time, where n is the length of the unanswered vaccines list from which the id of the input vaccine is being removed.
        public Boolean RemoveVaccination(Vaccine vaccine)
        {
            if (vaccine == null)
            {
                return(false);
            }
            int dueDate = vaccine.VaccineDueDate;

            if (this._unansweredVaccinations != null && this._unansweredVaccinations[(VaccinationDueDate)dueDate] != null)
            {
                return(this._unansweredVaccinations[(VaccinationDueDate)dueDate].Remove(vaccine.ID));
            }
            return(false);
        }
        // Removal takes O(n) time, where n is the length of the unanswered vaccines list from which the id of the input vaccine is being removed.
        public Boolean AddVaccination(Vaccine vaccine)
        {
            if (vaccine == null)
            {
                return(false);
            }
            int dueDate = vaccine.VaccineDueDate;

            if (this._unansweredVaccinations != null && this._unansweredVaccinations[(VaccinationDueDate)dueDate] != null)
            {
                _unansweredVaccinations[(VaccinationDueDate)dueDate].Add(vaccine.ID);
                return(true);
            }
            return(false);
        }
        /**
         * Retrieve a list of Vaccine objects from storage corresponding to the input list of vaccine ids.
         **/
        private List <Vaccine> GetVaccinationsByIds(List <int> ids)
        {
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            List <Vaccine> vaccines = new List <Vaccine>();

            if (ids != null && ids.Count > 0)
            {
                foreach (int vaccineID in ids)
                {
                    vaccines.Add(vaccineDatabaseAccess.GetVaccineSync(vaccineID));
                }
            }
            vaccineDatabaseAccess.CloseSyncConnection();
            Vaccine.SortVaccineListByDueDate(vaccines);
            return(vaccines);
        }