wrire results to db