The current occurrence_add method adds the occurrences that have been passed through to occurrence_history in bulk, without any modification or check.
The method breaks when we run it twice on the same repository. It will also fail if we add a new instance of the same occurrence but with a new validity date (and new pointer).
We should make sure that the method "closes" the current interval and "opens" a new one when we add new data.