// Raises the GameProperty.Changed and GameObject.PropertyChanged events.
        internal void OnChanged(GameProperty <T> property, T oldValue, T newValue)
        {
            var handler    = Changed;
            var gameObject = property.Owner;

            if (handler != null || gameObject.NeedToCallPropertyChanged)
            {
                // GameProperty.Changed or GameOwner.PropertyChanged must be called because event handlers
                // are registered.

                // Get args from resource pool
                var args = GamePropertyEventArgs <T> .Create(property, oldValue, newValue);

                // Call GameProperty.Changed event handlers.
                if (handler != null)
                {
                    handler(gameObject, args);
                }

                // Call the virtual OnPropertyChanged method of the GameObject.
                gameObject.OnPropertyChanged(property, oldValue, newValue);

                // Call GameObject to raise GameObject.PropertyChanged event.
                gameObject.OnPropertyChanged(args);
                gameObject.OnPropertyChanged(property.Metadata.PropertyChangedEventArgs);

                args.Recycle();
            }
            else
            {
                // Call the virtual OnPropertyChanged method of the GameObject.
                // (Derived classes can override this method.)
                gameObject.OnPropertyChanged(property, oldValue, newValue);
            }
        }
        // Raises the Changing event.
        internal void OnChanging(GameProperty <T> property, T oldValue, ref T newValue)
        {
            var handler = Changing;

            if (handler != null)
            {
                // Get args from resource pool.
                var args = GamePropertyEventArgs <T> .Create(property, oldValue, newValue);

                // Call event handlers.
                handler(property.Owner, args);

                // Changing event handlers can coerce the value. Return coerced value to caller.
                newValue = args.CoercedValue;

                args.Recycle();
            }
        }