https://s2-labs.com/developer-tutorials/best-practice-with-triggers/