This is only used in one place so probably better to inline it.