Identity db context

This PR addresses some of #8 .