Avoid endless loop when editing end time for an event

From first commit:

    On handling changes, removing old events required them being
    considered less than new event. Inserting new events to an index
    required them being less than old event.
    
    When editing ending time of an existing event, neither of the
    conditions applied. Thus the loop didn't proceed.

Disclaimer: don't still have full confidence whether the loop proceeds correctly or not, but at least it doesn't hang for this case. Would be quite nice having at least some unit test for it.