private void OnModelChanged(ModelEventBase modelEvent)
        {
            DiagramService.UpdateModel(modelEvent.NewModel);

            switch (modelEvent)
            {
            case ModelNodeUpdatedEvent modelNodeUpdatedEvent:
                DiagramService.UpdateModelNode(modelNodeUpdatedEvent.NewNode);
                break;

            case ModelNodeRemovedEvent modelNodeRemovedEvent:
                var removedNode = modelNodeRemovedEvent.RemovedNode;
                DiagramService.RemoveNode(removedNode.Id);
                break;

            case ModelRelationshipAddedEvent modelRelationshipAddedEvent:
                var addedRelationship = modelRelationshipAddedEvent.AddedRelationship;
                ShowModelRelationshipIfBothEndsAreVisible(addedRelationship, DiagramService.LatestDiagram);
                break;

            case ModelRelationshipRemovedEvent modelRelationshipRemovedEvent:
                var modelRelationship = modelRelationshipRemovedEvent.RemovedRelationship;
                DiagramService.RemoveConnector(modelRelationship.Id);
                break;

            case ModelClearedEvent _:
                DiagramService.ClearDiagram();
                break;
            }
        }
        private void OnModelChanged(ModelEvent modelEvent)
        {
            DiagramService.UpdateModel(modelEvent.NewModel);

            foreach (var itemChange in modelEvent.ItemEvents)
            {
                ProcessModelItemEvent(itemChange);
            }
        }