Database Code Reorganization

Moved all database related code into Models.py
Only this module should have any code that has anything to do with the
databases (Except Object creation/filtering which would obviously be in
the target modules). Import this module whenever database functionality
is needed.