Factor out old method of querying by id.