Added logic to resolve couchdb conflicts.