refactor actions for crud controller