finish refactor codes in add & edit dyansty