[api] move action type specific code from the controller into the models