i think this is better suited to the model rather than the controller