def METHOD_NAME(self, object, value, type):
    ct = ContentType.objects.get_for_model(object)
    object_id = object.pk
    # get the category
    category = self.get_or_create(name=prep_category(value))[0]
    cat_item_filters = {
        'content_type': ct,
        'object_id': object_id
    }
    # they can only be in one sub category or category
    if type == 'category':
        cat_item_filters.METHOD_NAME({'parent__exact':None})
        cat_item = CategoryItem._default_manager.get_or_create(**cat_item_filters)[0]
        cat_item.category = category
        cat_item.save()
    else: # sub category
        cat_item_filters.METHOD_NAME({'category__exact':None})
        cat_item = CategoryItem._default_manager.get_or_create(**cat_item_filters)[0]
        cat_item.parent = category
        cat_item.save()