Tag how to write effective apex trigger