generalized add/edit