public override void AfterSave()
        {
            base.AfterSave();

            if (string.IsNullOrEmpty(EntityFolderID))
            {
                throw new Exception("EntityFolderID not found");
            }

            Folder folder = new ORM <Folder>().Fetch(EntityFolderID);
            OPCServerFolderBehaviorData ext = folder?.GetExtensionData <OPCServerFolderBehaviorData>();

            if (ext != null)
            {
                if (Disabled)
                {
                    OPCEngine.RemoveEventGroup(ext.Url, ext.AgentId, Id);
                }
                else
                {
                    OpcEventGroup eventGroup = new OpcEventGroup
                    {
                        Paths      = EventValues?.Select(y => y.PathToValue).ToArray() ?? new string[0],
                        EventId    = Id,
                        Deadband   = Deadband,
                        UpdateRate = UpdateRate
                    };
                    OPCEngine.AddOrUpdateEventGroup(ext.Url, ext.AgentId, eventGroup);
                }
            }
        }
        public override void BeforeDelete()
        {
            base.BeforeDelete();

            if (string.IsNullOrEmpty(EntityFolderID))
            {
                return;
            }

            Folder folder = new ORM <Folder>().Fetch(EntityFolderID);
            OPCServerFolderBehaviorData ext = folder?.GetExtensionData <OPCServerFolderBehaviorData>();

            if (ext != null)
            {
                OPCEngine.RemoveEventGroup(ext.Url, ext.AgentId, Id);
            }
        }