handle exception about duplicate entry