Add database functionality

Change-Id: I22e914ef1ca6ec8217d131c073261b309d9f637e