'Does the heavy-lifting involved in saving. Updates or inserts the data
for a single table.'

def _save_table(self, raw=False, cls=None, force_insert=False, force_update=False, using=None, update_fields=None):

    meta = cls._meta
    non_pks = [f for f in meta.local_concrete_fields if (not f.primary_key)]
    if update_fields:
        non_pks = [f for f in non_pks if ((f.name in update_fields) or (f.attname in update_fields))]
    pk_val = self._get_pk_val(meta)
    pk_set = (pk_val is not None)
    if ((not pk_set) and (force_update or update_fields)):
        raise ValueError(u'Cannot    force    an    update    in    save()    with    no    primary    key.')
    updated = False
    if (pk_set and (not force_insert)):
        base_qs = cls._base_manager.using(using)
        values = [(f, None, (getattr(self, f.attname) if raw else f.pre_save(self, False))) for f in non_pks]
        forced_update = (update_fields or force_update)
        updated = self._do_update(base_qs, using, pk_val, values, update_fields, forced_update)
        if (force_update and (not updated)):
            raise DatabaseError(u'Forced    update    did    not    affect    any    rows.')
        if (update_fields and (not updated)):
            raise DatabaseError(u'Save    with    update_fields    did    not    affect    any    rows.')
    if (not updated):
        if meta.order_with_respect_to:
            field = meta.order_with_respect_to
            order_value = cls._base_manager.using(using).filter(**{field.name: getattr(self, field.attname)}).count()
            self._order = order_value
        fields = meta.local_concrete_fields
        if (not pk_set):
            fields = [f for f in fields if (not isinstance(f, AutoField))]
        update_pk = bool((meta.has_auto_field and (not pk_set)))
        result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
        if update_pk:
            setattr(self, meta.pk.attname, result)
    return updated
