Move RPC util functions out of server module.