'Called by Model when it changes'

def _notify_change(self, model, attr, old, new, hint=None, setter=None):

    from .server.events import ModelChangedEvent
    if (attr == 'name'):
        if (old is not None):
            self._all_models_by_name.remove_value(old, model)
        if (new is not None):
            self._all_models_by_name.add_value(new, model)
    if (hint is None):
        serializable_new = model.lookup(attr).serializable_value(model)
    else:
        serializable_new = None
    self._trigger_on_change(ModelChangedEvent(self, model, attr, old, new, serializable_new, hint, setter))
