private List<CustomCommandViewModel> CreateCustomCommandView()
        {
            List<CustomCommandViewModel> l = new List<CustomCommandViewModel>();
            foreach (var customCommand in this.j64Config.CustomCommands)
            {
                var ccvm = new CustomCommandViewModel()
                {
                    CommandName = customCommand.CommandName
                };

                int i = 1;
                foreach (var ca in customCommand.Actions)
                {
                    var cc = new ViewModels.Configure.CustomCommand()
                    {
                        Sequence = i,
                        Device = ca.Device,
                        ControlGroup = ca.Group,
                        Function = ca.Function
                    };
                    ccvm.commands.Add(cc);
                    i++;
                }

                l.Add(ccvm);
            }

            return l;
        }
        public IActionResult CreateCommand(string command)
        {
            int i = 0;
            foreach (var cmd in j64Config.CustomCommands)
            {
                if (cmd.CommandName.StartsWith("New Command"))
                    i++;
            }
            string cmdName = "New Command";
            if (i > 0)
                cmdName += " " + i.ToString();

            var cc = new CustomCommandViewModel()
            {
                OriginalCommandName = cmdName,
                CommandName = cmdName
            };

            return View("EditCommand", cc);
        }
        public IActionResult EditCommand(string command)
        {
            var customCommand = j64Config.CustomCommands.Find(x => x.CommandName == command);
            if (customCommand == null)
                return View("Index", CreateCustomCommandView());

            var cc = new CustomCommandViewModel()
            {
                OriginalCommandName = customCommand.CommandName,
                CommandName = customCommand.CommandName
            };
            return View(cc);
        }
        public IActionResult EditCommand(CustomCommandViewModel command)
        {
            var customCommand = j64Config.CustomCommands.Find(x => x.CommandName == command.OriginalCommandName);
            if (customCommand == null)
            {
                customCommand = new Models.CustomCommand()
                {
                    CommandName = command.CommandName
                };
                j64Config.CustomCommands.Add(customCommand);
            }
            customCommand.CommandName = command.CommandName;

            for (int i = 0; i < customCommand.Actions.Count; i++)
                customCommand.Actions[i].Sequence = i + 1;
            j64HarmonyGatewayRepository.Save(j64Config);

            return View("Index", CreateCustomCommandView());
        }