Fix/refactor db client

* Implement try/finally to `in-connection`
* Remove unnecessary lambda and replace anonymous function with lambda in `find-collentions`
* Simplify readability by extracting a function
* Use `when` instead of `if` when no `else` branch