public ActionResult Create(EditableMigraineViewModel migraineViewModel)
        {
            if (ModelState.IsValid)
            {
                var migraineModel = migraineViewModel.ToMigraineModel();
                //migraineModel.ID = Guid.NewGuid();
                DataContext.Migraines.Add(migraineModel);
                DataContext.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(migraineViewModel);
        }
        public ActionResult Edit(EditableMigraineViewModel migraineViewModel)
        {
            if (ModelState.IsValid)
            {
                var modelUpdates = migraineViewModel.ToMigraineModel();

                var migraineModel = HelperMethods.FindFromGuid(DataContext, migraineViewModel.ID.ToString());
                migraineModel.Update(modelUpdates);

                DataContext.Entry(migraineModel).State = EntityState.Modified;
                try
                {
                    DataContext.SaveChanges();
                }
                catch (Exception)
                {
                    DataContext.Entry(migraineModel).Reload();
                    DataContext.SaveChanges();
                    //DataContext.Refresh(RefreshMode.ClientWins, DataContext.Migraines);
                    //DataContext.SaveChanges();
                }
                return RedirectToAction("Index");
            }
            return View(migraineViewModel);
        }
        public static EditableMigraineViewModel FromMigraineModel(MigraineModel model)
        {
            var viewModel = new EditableMigraineViewModel(model.ID)
            {
                DateStarted = model.DateStarted,
                TimeStarted = model.TimeStarted, //model.TimeStarted.ToString("s"),
                TimeEnded = model.TimeEnded, //model.TimeEnded.ToString("s"),
                Severity = model.Severity,
                Comment = model.Comment,
                StillHappening = model.StillHappening,
                ID = model.ID
            };

            return viewModel;
        }