check duplication before adding new record to couchdb