Created a query function to return an array of results based on query parameters. This is based on the approach for the getAll method