Added some error handling to addrecord to write out if there was a duplicate error.