private void ChatService_Posted(Application.ChatLog obj)
        {
            if (!m_chatLogsState.AreEventsMonitored)
            {
                return;
            }

            // compose an event data
            var e       = new ChatLogEventState(null);
            var message = new TranslationInfo(
                "ChatLogEventType",
                "en-US",
                "New chat log has been posted for '{0}'.",
                m_chatLogsState.DisplayName);

            e.Initialize(
                SystemContext,
                m_chatLogsState,
                EventSeverity.MediumLow,
                new LocalizedText(message));
            e.ChatLog               = new ChatLogState(e);
            e.ChatLog.Value         = new ChatLog();
            e.ChatLog.Value.At      = obj.At;
            e.ChatLog.Value.Name    = obj.Name;
            e.ChatLog.Value.Content = obj.Content;

            m_chatLogsState.ReportEvent(SystemContext, e);
        }
        /// <summary>
        /// Replaces the generic node with a node specific to the model.
        /// </summary>
        protected override NodeState AddBehaviourToPredefinedNode(ISystemContext context, NodeState predefinedNode)
        {
            BaseObjectState passiveNode = predefinedNode as BaseObjectState;

            if (passiveNode == null)
            {
                return(predefinedNode);
            }

            NodeId typeId = passiveNode.TypeDefinitionId;

            if (!IsNodeIdInNamespace(typeId) || typeId.IdType != IdType.Numeric)
            {
                return(predefinedNode);
            }

            switch ((uint)typeId.Identifier)
            {
            // Write cases in same way for all defined ObjectTypes

            case ObjectTypes.ChatLogsType:
            {
                if (passiveNode is ChatLogsState)
                {
                    break;
                }

                ChatLogsState activeNode = new ChatLogsState(passiveNode.Parent);
                activeNode.Create(context, passiveNode);

                if (passiveNode.Parent != null)
                {
                    passiveNode.Parent.ReplaceChild(context, activeNode);
                }

                return(activeNode);
            }

            case ObjectTypes.ChatLogEventType:
            {
                if (passiveNode is ChatLogEventState)
                {
                    break;
                }

                ChatLogEventState activeNode = new ChatLogEventState(passiveNode.Parent);
                activeNode.Create(context, passiveNode);

                if (passiveNode.Parent != null)
                {
                    passiveNode.Parent.ReplaceChild(context, activeNode);
                }

                return(activeNode);
            }
            }

            return(predefinedNode);
        }