Refactor away RPCHandler::doRpcCommand().