public ActionResult Details(string id)
        {
            ViewBag.CurrentPage = "Children";
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Child child = db.Children.Find(id);
            if (child == null)
            {
                return HttpNotFound();
            }
            List<ChildMeasurement> measures = db.ChildMeasurements.Where(m => m.ChildID == id).OrderByDescending(c => c.Id).ToList();
            ChildMeasurement measure = measures.FirstOrDefault();
            child.HeadCircumference = (float)measure.HeadCircumference;
            child.Height = (float)measure.Height;
            child.Weight = (float)measure.Weight;
            //HttpSessionState sessionId = (HttpSessionState)HttpContext.Items["AspSession"];
            _childService.SetChildForSession(User.Identity.Name, child);
            //temp = child;
            child.Father = db.Parents.Where(p => p.IdNumber == child.FatherId).FirstOrDefault();
            child.Mother = db.Parents.Where(p => p.IdNumber == child.MotherId).FirstOrDefault();

            List<VaccinationDefinition> VaccinationDefs = db.VaccinationDefinitions.
                                            OrderBy(v => v.Age.Code).
                                            ToList();
            List<Vaccination> childVaccinations = db.Vaccinations.
                                            Where(v => v.IdNumber == child.IdNumber).
                                            ToList();

            Vaccinations = new List<ChildVaccination>();
            Vaccination lastVaccination = db.Vaccinations.OrderBy(v => v.Date).FirstOrDefault();
            if (lastVaccination != null)
            {
                DateTime lastVaccinationDate = lastVaccination.Date;
                foreach (var vaccine in VaccinationDefs)
                {
                    ChildVaccination cv = new ChildVaccination()
                    {
                        Age = vaccine.Age,
                        Code = vaccine.Code,
                        Description = vaccine.Description,
                        Name = vaccine.Name,
                        IdNumber = child.IdNumber,
                        Id = vaccine.Id,
                    };

                    Vaccination Vaccination = childVaccinations != null ? childVaccinations.Where(v => v.VaccinationDefinitionId == vaccine.Id).FirstOrDefault() : null;

                    if (Vaccination != null)
                    {
                        cv.Vaccinated = true;
                        cv.DateVaccinated = Vaccination.Date;
                        cv.Existing = true;
                        cv.Administrator = Vaccination.Administrator;
                        cv.SerialNumber = Vaccination.SerialNumber;
                        cv.Signature = Vaccination.Signature;
                    }
                    else
                    {
                        cv.DueDate = lastVaccinationDate.AddDays(vaccine.Age.Code * 7);
                    }

                    Vaccinations.Add(cv);
                }
            }
            child.VaccinationDetails = Vaccinations;
            var measurements = from cust in db.ChildMeasurements
                               where cust.ChildID == child.IdNumber
                               select cust;

            List<ChildMeasurement> tmpChildMeasurements = measurements.ToList();
            ViewBag.measurementsList = tmpChildMeasurements;
            return View(child);
        }
        public ActionResult ChildVaccinations(Child child)
        {
            ViewBag.CurrentPage = "Children";
            List<VaccinationDefinition> VaccinationDefs = db.VaccinationDefinitions.
                                                        OrderBy(v => v.Age.Code).
                                                        ToList();
            List<Vaccination> childVaccinations = db.Vaccinations.
                                            Where(v => v.IdNumber == child.IdNumber).
                                            ToList();

            List<ChildVaccination> Vaccinations = new List<ChildVaccination>();
            foreach (var vaccine in VaccinationDefs)
            {
                ChildVaccination cv = new ChildVaccination()
                {
                    Age = vaccine.Age,
                    Code = vaccine.Code,
                    ICDCode = vaccine.ICDCode,
                    Description = vaccine.Description,
                    Name = vaccine.Name,
                    IdNumber = child.IdNumber,
                    Id = vaccine.Id,
                };
                
                Vaccination Vaccination = childVaccinations != null ? childVaccinations.Where(v => v.VaccinationDefinitionId == vaccine.Id).FirstOrDefault() : null;

                if (Vaccination != null)
                {
                    cv.Vaccinated = true;
                    cv.DateVaccinated = Vaccination.Date;
                    cv.Existing = true;
                }
                else
                {
                    cv.DateVaccinated = null;
                }
                
                Vaccinations.Add(cv);
            }
            Vaccinations = Vaccinations.OrderBy(x => x.Age.Code).ToList();
            //VaccinationContainer vaxC = new VaccinationContainer()
            //{
            //    IdNumber = child.IdNumber,
            //    Vaccinations = Vaccinations
            //};

            

            return View(Vaccinations);
        }