The fact that this is in two places means a function might make sense.