Submit KPI data when the dialog closes either in the interaction_iframe OR in the internal_api.

Only generate GUIDs for a KPI blob whenever needed:

* When the dialog is orphaned AND
* A staging event occurs without a confirmation event.
Remove the linking_id
Remove indexOfEvent and hasEvent which should have been removed with the last commit.
Remove the orphaned KPI.