public void GenerateAndApplyReversePatch()
        {
            var initial = new PhoneBook()
            {
                Entries = new Dictionary <string, TestPerson>()
                {
                    ["0800JOHNDOE"] = new TestPerson()
                    {
                        FirstName = "John",
                        LastName  = "Doe",
                        IsAdult   = true,
                    },
                    ["0800JANEDOE"] = new TestPerson()
                    {
                        FirstName = "Jane",
                        LastName  = "Doe",
                        IsAdult   = true,
                    },
                },
            };

            using DraftScope scope = (DraftScope)DraftExtensions.CreateDraft(initial, out PhoneBook draft);

            var patchGenerator = new DictionaryPatchGenerator();
            var patches        = new JsonPatchDocument();
            var inversePatches = new JsonPatchDocument();

            draft.Entries.Remove("0800JANEDOE");
            draft.Entries.Add("0800BABYDOE", new TestPerson()
            {
                FirstName = "Baby",
                LastName  = "Doe",
            });

            // trick the scope into thinking that is finishing and should not create proxies anymore.
            scope.IsFinishing = true;

            patchGenerator.Generate((IDraft)draft.Entries, "/Entries", patches, inversePatches);

            // inverse order of inverse patches.
            inversePatches.Operations.Reverse();

            var final = scope.FinishDraft <PhoneBook, IPhoneBook>(draft);

            var result = IPhoneBook.Produce(initial, p =>
            {
                patches.ApplyTo(p);
            });

            result = result.Produce(p =>
            {
                inversePatches.ApplyTo(p);
            });

            Assert.Equal(2, result.Entries.Count);
            Assert.Same(initial.Entries["0800JOHNDOE"], result.Entries["0800JOHNDOE"]);
            Assert.Same(initial.Entries["0800JANEDOE"], result.Entries["0800JANEDOE"]);
        }