Making sure the replication task is idempotent