I've refactored this code in the apps and services init classes. Please use that abstraction for consistency. 
We may also want to think about abstracting the whole file, now that the pattern is virtually identical in 3 places.