How to check if model has changes?

What is the correct way to check if GraphModel has changes?

I have tried UndoManager.CompoundEdits.Count() > 0 but that does not seem to work.
What is the correct way to clear the GraphModel UndoManager?
Thank you,
Pavel

DiagramModel.IsModified

UndoManager.Clear()

Thank you Walter … I was blind