Added try/except block to catch duplicate mysql errors