storing results in database