def _update_error_count(error_id, events_removed):
    @db.transactional(xg=True)
    def txn():
        _error = Error.objects.get(pk=error_id)
        _error.event_count -= events_removed
        _error.save()
    txn()