Handle unique constraint fails.