Split CDB functions off to its own library

Change-Id: Idbbfb582510002375f128916840c5f1cb601998f