internal ParseResult Parse(string[] args)
        {
            if (args == null || args.Length == 0) {
                throw new CommandLineParseException(String.Format("Expected atleast one command. Options are : [{0}]",
                    String.Join(",", m_options.Keys)));
            }
            var result = new ParseResult();

            var cmd = args[0];
            if (!m_options.ContainsKey(cmd)) {
                throw new CommandLineParseException(String.Format("Unrecognized command '{0}', valid commands are : [{1}]",
                    cmd, String.Join(",", m_options.Keys)));
            }
            result.Command = cmd;
            var options = m_options[cmd];

            for (int i = 1; i < args.Length; i++) {
                var optName = args[i];
                if (!options.ContainsOption(optName)) {
                    throw new CommandLineParseException(String.Format("Unrecognized option '{0}' for command '{1}', valid options are : [{2}]",
                        optName, cmd, String.Join(",", options.OptionKeys)));
                }
                if (i < args.Length - 1) {
                    i++;
                    var optVal = args[i];
                    result.AddOptionValue(optName, optVal);
                } else {
                    result.AddOptionValue(optName, null);
                }
            }
            return result;
        }