Factor out common method in client