I'd move this into an extra helper file and make it a non-class helper function.