Only inserts metadata when a fact (name, value) already exists

This is the first step towards actually getting historical facts
working. To reduce on space utilisation keep the facts database as the
store of name/value pairs and have the temporal reference kept in the
facts_metadata table.