refactor and add tests for service
add tests for service
Merge branch 'mongodb'