move actions to model and add rake task