// GET: /GDSEndWarningConfiguration/Edit
        public ActionResult Edit(int id)
        {
            //Get Item From Database
            GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration();

            gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id);

            //Check Exists
            if (gdsEndWarningConfiguration == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            //Check Access
            if (!rolesRepository.HasWriteAccessToGDSEndWarningConfiguration())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM = new GDSEndWarningConfigurationVM();

            gdsEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration;

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName", gdsEndWarningConfiguration.GDSCode);

            gdsEndWarningConfigurationVM.GDSs = gDSs;

            //GDSEndWarningBehaviorTypes
            GDSEndWarningBehaviorTypeRepository gdsEndWarningBehaviorTypeRepository = new GDSEndWarningBehaviorTypeRepository();
            SelectList gdsEndWarningBehaviorTypes = new SelectList(gdsEndWarningBehaviorTypeRepository.GetAllGDSEndWarningBehaviorTypes().ToList(), "GDSEndWarningBehaviorTypeId", "GDSEndWarningBehaviorTypeDescription", gdsEndWarningConfiguration.GDSEndWarningBehaviorTypeId);

            gdsEndWarningConfigurationVM.GDSEndWarningBehaviorTypes = gdsEndWarningBehaviorTypes;

            //Automated Commands
            if (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands == null ||
                (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands != null && gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands.Count < 1))
            {
                List <AutomatedCommand> automatedCommands = new List <AutomatedCommand>();
                AutomatedCommand        automatedCommand  = new AutomatedCommand()
                {
                    CommandExecutionSequenceNumber = 1
                };
                automatedCommands.Add(automatedCommand);
                ViewData["AutomatedCommands"] = automatedCommands;
            }
            else
            {
                ViewData["AutomatedCommands"] = gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands;
            }

            ViewData["WarningMessage"] = gdsEndWarningConfiguration.IdentifyingWarningMessage;

            return(View(gdsEndWarningConfigurationVM));
        }
        //
        // GET: /GDSEndWarningConfiguration/Create

        public ActionResult Create()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM = new GDSEndWarningConfigurationVM();

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName");

            gdsEndWarningConfigurationVM.GDSs = gDSs;

            //GDSEndWarningBehaviorTypes
            GDSEndWarningBehaviorTypeRepository gdsEndWarningBehaviorTypeRepository = new GDSEndWarningBehaviorTypeRepository();
            SelectList gdsEndWarningBehaviorTypes = new SelectList(gdsEndWarningBehaviorTypeRepository.GetAllGDSEndWarningBehaviorTypes().ToList(), "GDSEndWarningBehaviorTypeId", "GDSEndWarningBehaviorTypeDescription");

            gdsEndWarningConfigurationVM.GDSEndWarningBehaviorTypes = gdsEndWarningBehaviorTypes;

            //Automated Commands
            List <AutomatedCommand> automatedCommands = new List <AutomatedCommand>();
            AutomatedCommand        automatedCommand  = new AutomatedCommand();

            automatedCommands.Add(automatedCommand);
            gdsEndWarningConfigurationVM.AutomatedCommands = automatedCommands;

            GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration();

            gdsEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration;

            return(View(gdsEndWarningConfigurationVM));
        }