Throwing database-related "messy" code into Database