final protected function setModelValue($propertyName, $value)
    {
        try {
            $oldValue = (isset($this->modelData[$propertyName])) ? $this->modelData[$propertyName]: null;
        } catch (\Exception $ex) {
            // Catch any exceptions thrown when trying to retrieve the old value for the sake
            // of comparison to trigger the property changed handlers.
            $oldValue = null;
        }

        $this->modelData[$propertyName] = $value;

        if ($value instanceof ModelState) {
            $this->attachChangeListenerToModelProperty($propertyName, $value);
        }

        if ($oldValue != $value) {
            if (!$this->propertyChangeEventsDisabled) {
                // Don't fire changes if they are disabled.
                $this->raisePropertyChangedCallbacks($propertyName, $value, $oldValue);
                $this->traitRaiseEvent("AfterChange", $this);
            }
        }
    }