Separate database code into its own package