public async Task <IActionResult> OnPostAsync(string op = null)
        {
            bool?  hfc   = null;
            string pn    = null;
            string nh    = null;
            int?   np    = null;
            bool   valid = !String.IsNullOrEmpty(Type) && !String.IsNullOrEmpty(Name) && !String.IsNullOrEmpty(Connection);

            switch (Connection)
            {
            case DiscChanger.Models.DiscChanger.CONNECTION_SERIAL_PORT:
                if (HardwareFlowControl != null)
                {
                    hfc = Boolean.Parse(HardwareFlowControl);
                }
                pn    = PortName;
                valid = valid && !String.IsNullOrEmpty(pn);
                break;

            case DiscChanger.Models.DiscChanger.CONNECTION_NETWORK:
                nh    = NetworkHost?.Trim(); np = NetworkPort;
                valid = valid && !String.IsNullOrEmpty(nh) && np > 1;
                break;
            }
            switch (op)
            {
            case "OK":
                if (valid)
                {
                    if (!String.IsNullOrEmpty(Key))
                    {
                        discChangerService.Update(Key, Name, Type, Connection, CommandMode, pn, hfc, nh, np);
                    }
                    else
                    {
                        discChangerService.Add(Name, Type, Connection, CommandMode, pn, hfc, nh, np);
                    }
                    return(RedirectToPage("Index"));
                }
                break;

            case "Cancel":
                return(RedirectToPage("Index"));

            case "Test":
                if (valid)
                {
                    this.TestResult = await discChangerService.Test(Key, Type, Connection, CommandMode, pn, hfc, nh, np);
                }
                break;
            }
            updateModel(Key);
            return(Page());
        }