added exception handling on database commit