'Store to entity, deleting dynamic properties that no longer exist.
When the expando is saved, it is possible that a given property no longer
exists.  In this case, the property will be removed from the saved instance.
Args:
entity: Entity which will receive dynamic properties.'

def _to_entity(self, entity):

    super(Expando, self)._to_entity(entity)
    if (self._dynamic_properties is None):
        self._dynamic_properties = {}
    for (key, value) in self._dynamic_properties.iteritems():
        entity[key] = value
    all_properties = set(self._dynamic_properties.iterkeys())
    all_properties.update(self._all_properties)
    for key in entity.keys():
        if (key not in all_properties):
            del entity[key]
