Added code to insert full results to database