Put this logic in the controller.