Database: move logic from Connection to Context