refactor in save controller