Added dbgateway and associated unit tests