Introduction:
In my current setup, I have an object called `Item` that consists of an array of `Group(s)`, with each group containing an array of `User(s)`. The `Item` object exposes various APIs such as `addUser`, `removeUser`, `addGroup`, `removeGroup`, `addUnit`, and `removeUnit`. Every time one of these actions is taken, the `rank` property of each user within a certain group needs to be recalculated.
I am seeking a solution where the method `calcRank` is automatically triggered at the end of each API action without the need for explicit invocation. Something akin to an `OnExit` decorator would be ideal.