Refactor the code related with OnlineClient/PendingClient.