handle exceptions when attempting to add to storage

avoid duplicate resource issue in postgresql storage.