generic insert and delete