JFG-691Migrate db querying from WebUi