public static Command parse(String commandAsStr) {
        commandAsStr = commandAsStr.trim();
        if ("".equals(commandAsStr)) {
            return new Command(Commands.UNKNOWN, "unknown command");
        }

        String commandName = getCommandName(commandAsStr);
        List<String> args = getArgs(commandAsStr);

        int commandArity = args.size();

        for (Commands command : Commands.values()) {
            if (command.getName().equals(commandName) && command.isArityAvailiable(commandArity)) {
                return new Command(command, args);
            } else if (command.getName().equals(commandName) && !command.isArityAvailiable(commandArity)) {
                return new Command(Commands.UNKNOWN, "command " + commandName + " mustn't have " + commandArity + " arguments");
            }
        }
        return new Command(Commands.UNKNOWN, "unknown command name. Enter help command to see avaliable commands");
    }