public ActionResult AddForm()
        {
            int formCount = svc.GetForms().Count == 0 ? 1 : svc.GetForms().Count + 1;
            var frm = new Form();

            frm.Id = 0;
            frm.Name = "New Form " + formCount.ToString();
            frm.Description = "New form " + formCount.ToString();

            frm.Questions = new List<Question>();

            frm.Questions.Add(new Question
            {
                Id = 0,
                Description = "Enter Question",
                Answers = new List<Answer>(){
                    new Answer{Id=0,
                        Description="",
                        NextQuestionId=0}
                    }
            });

            svc.UpdateForm(frm);

            return RedirectToAction("Menu");
        }
        public ActionResult CopyForm(Form frm)
        {
            int formCount = svc.GetForms().Count == 0 ? 1 : svc.GetForms().Count + 1;

            //var frm = svc.GetForm(formId);

            frm.Id = 0;
            frm.Name +="-COPY "+ formCount.ToString();
            //frm.Description += "N " + formCount.ToString();

            svc.UpdateForm(frm);

            return RedirectToAction("Menu");
        }
        public bool UpdateForm(Form form)
        {
            //context.Entry(form).State = form.Id == 0 ?
            //                      EntityState.Added :
            //                      EntityState.Modified;
            if(form.Id==0)
            {
                context.Forms.Add(form);

            }
            else {
                context.UpdateGraph(form, map => map
                                .OwnedCollection(p => p.Questions, with => with
                                    .OwnedCollection(p => p.Answers)));
            }

            context.SaveChanges();

            return true;
        }
        public JsonResult Demo()
        {
            var frm = new Form();

            frm.Id = 1;
            frm.Name = "Roadmap for Reflection";
            frm.Description = "Roadmap for Reflection";

            frm.Questions = new List<Question>();

            frm.Questions.Add(new Question
            {
                Id = 1,
                Description = "What is the job going to help you do?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Next",
                        NextQuestionId=2}
                    }
            });

            frm.Questions.Add(new Question
            {
                Id = 2,
                Description = "What kind of job are you thinking about?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Next",
                        NextQuestionId=3}
                    }
            });

            frm.Questions.Add(new Question
            {
                Id = 3,
                Description = "How will that help you provide long-term for your family?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Will Provide",
                        NextQuestionId=4},
                    new Answer{Id=2,
                        Description="Won't Provide",
                        NextQuestionId=5},
                    }
            });

            frm.Questions.Add(new Question
            {
                Id = 4,
                Description = "What have you done so far?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Something",
                        NextQuestionId=6},
                    new Answer{Id=2,
                        Description="Nothing",
                        NextQuestionId=7},
                    }
            });
            frm.Questions.Add(new Question
            {
                Id = 5,
                Description = "What are your thoughts about a long-yerm solution (to financial stability)?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Know",
                        NextQuestionId=2},
                    new Answer{Id=2,
                        Description="Don't Know",
                        NextQuestionId=4},
                    }
            });

            frm.Questions.Add(new Question
            {
                Id = 6,
                Description = "What are your next steps?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Know",
                        NextQuestionId=8},
                    new Answer{Id=2,
                        Description="Don't Know",
                        NextQuestionId=7},
                    }
            });

            frm.Questions.Add(new Question
            {
                Id = 7,
                Description = "Based on your past experience or what you know about job hunting, how could you get started?",
                Answers = new List<Answer>(){
                    new Answer{Id=1,
                        Description="Know",
                        NextQuestionId=6},
                    new Answer{Id=2,
                        Description="Don't Know",
                        NextQuestionId=8},
                    }
            });

            frm.Questions.Add(new Question
            {
                Id = 8,
                Description = "When should we revisit this plan?",
                Answers = new List<Answer>()
            });

            JsonResult jr= new JsonResult();

            //jr.Data=frm;
            return Json(frm,JsonRequestBehavior.AllowGet);
        }
        public ActionResult Update(Form frm)
        {
            svc.UpdateForm(frm);

            return View("Build",frm);
        }