Remove repetitive code in connection visitors using a helper method