Split DB into its own layer.
Modify API to use new types and DB.
New DB abstraction.