public override async Task Execute(string[] args, bool isRoot)
        {
            switch (CliParseUtil.TryShiftString(args, out args))
            {
            case "device":

                var deviceId = CliParseUtil.TryShiftId(args, out args);
                if (deviceId.HasValue)
                {
                    var client = await parent.GetLoggedInClient();

                    Console.WriteLine("Starting a Lock task for Device " + deviceId.ToString());
                    await client.LockDevice(deviceId.Value);

                    if (args.Length > 0)
                    {
                        await parent.Execute(args, false);
                    }
                }
                else
                {
                    Console.WriteLine("Usage: profilemanager lock device <id>");
                }

                break;

            case "group":

                var groupId = CliParseUtil.TryShiftId(args, out args);
                if (groupId.HasValue)
                {
                    var client = await parent.GetLoggedInClient();

                    Console.WriteLine("Starting a Lock task for Group " + groupId.ToString());
                    await client.LockDeviceGroup(groupId.Value);

                    if (args.Length > 0)
                    {
                        await parent.Execute(args, false);
                    }
                }
                else
                {
                    Console.WriteLine("Usage: profilemanager lock group <id>");
                }

                break;

            default:

                Console.WriteLine("Usage: profilemanager lock <device|group> <id>");

                return;
            }
        }
        public override async Task Execute(string[] args, bool isRoot)
        {
            // Handle environment variables
            SetGlobal("SERVER", Environment.GetEnvironmentVariable("PROFILEMANAGER_SERVER"));
            SetGlobal("USERNAME", Environment.GetEnvironmentVariable("PROFILEMANAGER_USERNAME"));
            SetGlobal("PASSWORD", Environment.GetEnvironmentVariable("PROFILEMANAGER_PASSWORD"));

            // Handle arguments
            string command = CliParseUtil.TryShiftString(args, out args);

            // Handle no arguments
            if (command == null)
            {
                if (isRoot)
                {
                    ShowHelp();
                }
                return;
            }

            // Handle pre-command arguments
            while (command.StartsWith("-"))
            {
                switch (command)
                {
                case "-h":
                case "--help":
                    ShowHelp();
                    return;

                case "-v":
                case "--version":
                    Console.WriteLine("Version: {0}", typeof(CliClient).Assembly.GetName().Version);
                    return;

                case "-u":
                case "--username":
                    string username = CliParseUtil.TryShiftString(args, out args);
                    if (username == null)
                    {
                        Console.WriteLine("Option '{0}' requires a value", command);
                        ShowHelp();
                        return;
                    }
                    else
                    {
                        SetGlobal("USERNAME", username);
                    }
                    break;

                case "-p":
                case "--password":
                    string password = CliParseUtil.TryShiftString(args, out args);
                    if (password == null)
                    {
                        Console.WriteLine("Option '{0}' requires a value", command);
                        ShowHelp();
                        return;
                    }
                    else
                    {
                        SetGlobal("PASSWORD", password);
                    }
                    break;

                case "-s":
                case "--server":
                    string server = CliParseUtil.TryShiftString(args, out args);
                    if (server == null)
                    {
                        Console.WriteLine("Option '{0}' requires a value", command);
                        ShowHelp();
                        return;
                    }
                    else
                    {
                        SetGlobal("SERVER", server);
                    }
                    break;

                default:
                    Console.WriteLine("Unknown Option '{0}'", command);
                    ShowHelp();
                    return;
                }

                command = CliParseUtil.TryShiftString(args, out args);
            }

            // Handle commands
            if (command == "help" || command == "version")
            {
                ShowHelp();
                return;
            }

            var commandEvaluator = subcommands.GetValueOrDefault(command, null);

            if (commandEvaluator == null)
            {
                Console.WriteLine("Unknown Command '{0}'", command);
                ShowHelp();
                return;
            }
            else
            {
                await commandEvaluator.Execute(args, false);
            }
        }