Refactor RemoteApi