Does it not make sense to move this logic into the API?