Add a duplicate entry test avoiding integrity error while db insertion in events table