I saw that you use this check for all commands. Consider extracting it in separate method.