It's better to have this sort of logic in the controller