Code optimization and pre_save in POST API