button save and cancel
remove duplicated codes