Reimplement our database API

Change-Id: I8eef9ce351217f8dd945e90d1d3f413052e935b8
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>