refactoring merge update and create