public bool UpdatePlayerEnergy(int playerId)
        {
            Player player = _iplayerContext.GetPlayerWithId(playerId);

            // Difference between now and LastTimeEnergyRefilled
            DateTime startTime         = player.LastTimeEnergyRefilled;
            DateTime endTime           = DateTime.Now;
            double   timeDiffInMinutes = endTime.Subtract(startTime).TotalMinutes;

            // For every 5 mins in difference, add energyRegen(default = 5)
            player.RefillableEnergy += (int)Math.Floor((timeDiffInMinutes / 5)) * player.EnergyRegen;

            // Handeling of exess Energy and updating the new Energy
            if (player.RefillableEnergy > 0 &&
                player.Energy < player.MaxEnergy)
            {
                int excessEnergy;
                if (player.Energy + player.RefillableEnergy > player.MaxEnergy)
                {
                    excessEnergy = player.Energy + player.RefillableEnergy - player.MaxEnergy;
                    _iplayerContext.UpdatePlayerEnergy(player.PlayerId, excessEnergy, player.MaxEnergy);
                }
                else
                {
                    excessEnergy = 0;
                    _iplayerContext.UpdatePlayerEnergy(player.PlayerId, excessEnergy, player.Energy + player.RefillableEnergy);
                }
                return(true);
            }
            return(false);
        }