/// <summary>
        /// Performs a validations when the user tries to change some of the units skill points.
        /// The new value (value + change) of the skill must be between the mininum and maximum value
        /// for that skill and team must still have points left to expend.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="maxValue"></param>
        /// <param name="minValue"></param>
        /// <param name="change"></param>
        /// <returns></returns>
        private double TryChangeDouble(double value, double maxValue, double minValue, double change)
        {
            var newVal    = value + change;
            var newPoints = Points + (change < 0 ? 1 : -1);

            if (newVal <= maxValue && newVal >= minValue && newPoints >= 0 && newPoints <= MainViewModel.MAX_TEAM_POINTS)
            {
                value       = newVal;
                Points      = newPoints;
                UsedPoints += (change < 0 ? -1 : 1);
                ObserverHelper <MainViewModel, int> .NotifyObservers(this, Points);
            }
            return(value);
        }
        /// <summary>
        /// When a unit dies, the MainViewModel unsubscribes the unit events, restores unit points to the
        /// total of the team points and remove it from the field of battle.
        /// </summary>
        /// <param name="sender">The dead unit</param>
        /// <param name="Team">The team of the dead unit</param>
        private void Unit_UnitDied(object sender, UnitTeam Team)
        {
            var unit = sender as UnitViewModel;

            unit.UnitAttack -= Unit_UnitAttack;
            unit.UnitDied   -= Unit_UnitDied;
            if (Team == UnitTeam.Red)
            {
                ListRedUnits.Remove(unit);
                ObserverHelper <MainViewModel, int> .NotifyObservers(unit, RedPoints + unit.UsedPoints);
            }
            else
            {
                ListBlueUnits.Remove(unit);
                ObserverHelper <MainViewModel, int> .NotifyObservers(unit, BluePoints + unit.UsedPoints);
            }
        }