private static IEnumerable <ChangeInfo> GetTextChangelist(IMsgBlockService unchangedService, IMsgBlockService changedService)
    {
        var changelist = new List <ChangeInfo>();

        for (int i = 0; i < Math.Min(unchangedService.BlockCount, changedService.BlockCount); i++)
        {
            var unchangedBlock = unchangedService.Retrieve(i);
            var changedBlock   = changedService.Retrieve(i);

            for (int j = 0; j < Math.Min(unchangedBlock.Count, changedBlock.Count); j++)
            {
                var unchangedMsg = unchangedBlock[j];
                var changedMsg   = changedBlock[j];

                bool textChanged      = unchangedMsg.Text != changedMsg.Text;
                bool contextChanged   = unchangedMsg.Context != changedMsg.Context;
                bool boxConfigChanged = unchangedMsg.BoxConfig != changedMsg.BoxConfig;

                if (textChanged || contextChanged || boxConfigChanged)
                {
                    string objectId = $"Block_{i}_Msg_{j}";

                    if (textChanged)
                    {
                        changelist.Add(new ChangeInfo(
                                           TypeName: "Messages",
                                           ObjectId: objectId,
                                           PropertyName: "Text",
                                           OldValue: unchangedMsg.Text,
                                           NewValue: changedMsg.Text
                                           ));
                    }

                    if (contextChanged)
                    {
                        changelist.Add(new ChangeInfo(
                                           TypeName: "Messages",
                                           ObjectId: objectId,
                                           PropertyName: "Context",
                                           OldValue: unchangedMsg.Context,
                                           NewValue: changedMsg.Context
                                           ));
                    }

                    if (boxConfigChanged)
                    {
                        changelist.Add(new ChangeInfo(
                                           TypeName: "Messages",
                                           ObjectId: objectId,
                                           PropertyName: "BoxConfig",
                                           OldValue: unchangedMsg.BoxConfig,
                                           NewValue: changedMsg.BoxConfig
                                           ));
                    }
                }
            }
        }

        return(changelist);
    }
 public CachedMsgBlockService(IMsgBlockService msgBlockService)
 {
     _msgBlockService = msgBlockService;
     RebuildCache();
 }