refactoring to mongo database adapter, splitting up responsibilities to try and get more test coverage there