Moved sql methods to Db class