detect tags on insert and update