DRYing up API resource handling