In my game, there is an energy system with a maximum value of X and a minimum of 0. When a player enters a battle, the energy decreases by 5. Every 5 minutes, the energy is restored by 1. For example, if the energy was 30 and the player entered a battle, it would become 25. After 5 minutes, it should become 26. What is the best approach to implement such a mechanic using PlayFab and Azure?