insert and update with general purpose