handle logic after couchDB calls