refactory ProcessCommand.cs