stage: move logic from controller to model