Adding in the database code

Change-Id: I3c355cd62612b537c1da077c7b067fb2b9be136e