created methods to query database based on arbitrary queries.