moved action controller code to model