write facts to db