'Save, while obeying the max count.'

def save(self, *args, **kwargs):

    super(SyncSession, self).save(*args, **kwargs)
    if ((settings.SYNC_SESSIONS_MAX_RECORDS is not None) and (SyncSession.objects.count() > settings.SYNC_SESSIONS_MAX_RECORDS)):
        for model in list(SyncSession.objects.order_by('timestamp')[0:(SyncSession.objects.count() - settings.SYNC_SESSIONS_MAX_RECORDS)]):
            model.delete()
