too much logic in controller, move to model