Has prostgres specific code to be removed once this works out. Explicit update statements for updating tag_records and explicit commit statements