Actually write all changes to agent to the db