refactor edit view when creating or updating