Got the collections to sql and querying correctly