'Adds an item to the container.
Arguments:
* model - the class of the object being added.
* pk - the primary key.
* obj - the object itself.
* parent_model - the model of the parent object that this object was
reached through.
* parent_obj - the parent object this object was reached
through (not used here, but needed in the API for use elsewhere)
* nullable - should be True if this relation is nullable.
Returns True if the item already existed in the structure and
False otherwise.'

def add(self, model, pk, obj, parent_model, parent_obj=None, nullable=False):

    if (pk in self.blocked.get(model, {})):
        return True
    d = self.data.setdefault(model, SortedDict())
    retval = (pk in d)
    d[pk] = obj
    if ((parent_model is not None) and (not nullable)):
        self.children.setdefault(parent_model, []).append(model)
    return retval
