Move database code into correct package