public ActionResult AddMaintenanceGroup(string submitButton, MaintenangeGroupCreateModel model)
        {
            // Was action RETURN?
            if (submitButton.Equals("RETURN"))
            {
                return(RedirectToAction("Index", new { rtn = "true" }));
            }

            try
            {
                if (ModelState.IsValid)
                {
                    var customerFactory = new CustomerFactory(model.ConnectionStringName);
                    // Validate that this model.Id has not yet been used.
                    if (customerFactory.CustomerIdExists(model.Id))
                    {
                        // Cannot use this id.
                        ModelState.AddModelError("Id", "Id already in use.");
                    }

                    if (customerFactory.CustomerNameExists(model.DisplayName))
                    {
                        // Cannot use this name.
                        ModelState.AddModelError("DisplayName", "Name already in use.");
                    }

                    if (!ModelState.IsValid)
                    {
                        model.ConnectionStrings = SettingsFactory.GetMaintenanceGroupConnectionStringNames();
                        return(View(model));
                    }

                    // At this point, can create new customer.
                    // Get server-relative paths for create customer process.

                    string templateFolder = Server.MapPath(ConfigurationManager.AppSettings["rbac.menu.template.dir"]);
                    string workingFolder  = Server.MapPath(ConfigurationManager.AppSettings["rbac.menu.template.upload"]);
                    //create the new maint group here
                    int customerId = (new MaintenanceGroupFactory()).CreateNewMaintananceGroup(model, templateFolder, workingFolder);
                    if (customerId == 0)
                    {
                        var ei = new ErrorItem()
                        {
                            ErrorCode    = "1236",
                            ErrorMessage = "General failure creating new maintenance group."
                        };

                        ViewData["__errorItem"] = ei;
                        model.ConnectionStrings = SettingsFactory.GetMaintenanceGroupConnectionStringNames();
                        return(View(model));
                    }

                    // Success creating new customer. Redirect to Edit
                    return(RedirectToAction("EditMaintenanceGroup", new { customerId = model.Id }));
                }
                model.ConnectionStrings = SettingsFactory.GetMaintenanceGroupConnectionStringNames();
                return(View(model));
            }
            catch (Exception ex)
            {
                var ei = new ErrorItem()
                {
                    ErrorCode    = "1237",
                    ErrorMessage = "General failure creating new maintenance group.  " + ex.Message
                };

                ViewData["__errorItem"] = ei;
                model.ConnectionStrings = SettingsFactory.GetMaintenanceGroupConnectionStringNames();
                return(View(model));
            }
        }