Remove duplicate code for View method in CouchDatabase