public ActionResult Ingest(FormIngestionViewModel model)
        {
            GoogleSheetService srv = new GoogleSheetService(model.SpreadSheetId, Db);

            if (model.Button == "Ingest")
            {
                //All settings have been specified. Ready to create the form.

                Form form = srv.CreateForm(model);
                if (form != null)
                {
                    Db.FormTemplates.Add(form);
                    Db.SaveChanges();
                    return(RedirectToAction("Edit", new { id = form.Id }));
                }

                model.ColumnHeadings = srv.GetColumnHeadings(model.DataSheet);
                return(View(model));
            }
            else
            {
                //Settings are being specified

                if (string.IsNullOrEmpty(model.SpreadSheetId))
                {
                    return(View(model));
                }

                if (string.IsNullOrEmpty(model.DataSheet))
                {
                    ViewBag.SheetList = srv.GetSheetNames();
                    return(View(model));
                }

                model.ColumnHeadings = srv.GetColumnHeadings(model.DataSheet);

                if (model.PreContextColumns.Count < model.PreContextColumnCount)
                {
                    for (int i = model.PreContextColumns.Count; i < model.PreContextColumnCount; ++i)
                    {
                        model.PreContextColumns.Add("");
                    }
                }

                return(View(model));
            }
        }
        public ActionResult Ingest()
        {
            FormIngestionViewModel model = new FormIngestionViewModel();

            return(View(model));
        }