move results db queries into a dedicated method