'Set an attribute value on the given instance and \'commit\' it.'

def set_committed_value(self, state, dict_, value):

    (collection, user_data) = self._initialize_collection(state)
    if value:
        collection.append_multiple_without_event(value)
    state.dict[self.key] = user_data
    state._commit(dict_, [self.key])
    if (self.key in state._pending_mutations):
        state._modified_event(dict_, self, user_data, True)
        pending = state._pending_mutations.pop(self.key)
        added = pending.added_items
        removed = pending.deleted_items
        for item in added:
            collection.append_without_event(item)
        for item in removed:
            collection.remove_without_event(item)
    return user_data
