Database code

Change-Id: I22ed1d4bda5e2810e330b3df3ca7fe99a3f64ece