Remove duplicated code in RemoteMessengerService