Refactor couchcrud retrieve