Add stubs for the REPLACE mode; refactor table insert/delete logic so the audit table stuff is handled in one place