public ActionResult Create(FormCollection form)
        {
            ValidateModel(form);

            try
            {
                Models.Job job = new Models.Job();
                UpdateModel(job);

                // Test this here rather than further up so we get the errors from update model even
                // if the manual validation fails
                if (!ModelState.IsValid)
                    throw new InvalidOperationException("Input failed model validation");

                job.Save();

                return RedirectToAction("Index");
            }
            catch
            {
                ViewData["ClientList"] = new SelectList(Models.Client.SelectAll(), "ClientId", "Name");
                return View();
            }
        }
        public ActionResult Edit(string id, FormCollection form)
        {
            ValidateModel(form);

            try
            {
                Models.Job job = new Models.Job(id);

                if (id != form["JobId"]) // Primary key updated
                {
                    // Cheesey cascade update
                    Models.Job newJob = new Models.Job();
                    UpdateModel(newJob);

                    if (!ModelState.IsValid)
                        throw new InvalidOperationException("Input failed model validation");

                    newJob.Save();

                    foreach (Models.TimeBlock timeBlock in Models.TimeBlock.SelectByJobId(id))
                    {
                        timeBlock.JobId = newJob.JobId;
                        timeBlock.Save();
                    }

                    job.Delete();
                }
                else
                {
                    UpdateModel<Models.Job>(job);
                    if (!ModelState.IsValid)
                        throw new InvalidOperationException("Input failed model validation");
                    job.Save();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                ViewData["ClientList"] = new SelectList(Models.Client.SelectAll(), "ClientId", "Name");
                return View();
            }
        }