public static void InsertDependency(IFigure figure, int index, IFigure dependency) { var action = new CallMethodAction( () => { figure.InsertDependencyCore(index, dependency); }, () => { figure.RemoveDependencyCore(index, dependency); }); figure.Drawing.ActionManager.RecordAction(action); }