private void FindIncomingElements()
        {
            ObjectAttribute      attr = null;
            ObjectAttributeValue ObjectAttributeValue = null;
            ObjectEntry          referencedobject     = null;
            int elementIndex = 0;

            for (int i = 0; i < this.RouteElements.Count; i++)
            {
                if (RouteElements[i].objectType.name.Equals("Monitoring"))
                {
                    MonitoringElementIndex = i;
                }
                for (int j = RouteElements[i].attributes.Length - 1; j >= 0; j--)
                {
                    attr = RouteElements[i].attributes[j];
                    for (int k = 0; k < attr.ObjectAttributeValues.Count; k++)
                    {
                        ObjectAttributeValue = attr.ObjectAttributeValues[k];
                        referencedobject     = ObjectAttributeValue.referencedObject;
                        if (referencedobject != null)
                        {
                            if (referencedobject.objectType.parentObjectTypeId == 257)
                            {
                                if (ServiceElementNameList.ContainsKey(referencedobject.name))
                                {
                                    if (ElementIncomingElementIndexes[i] == null)
                                    {
                                        ElementIncomingElementIndexes[i] = new HashSet <int>();
                                    }
                                    elementIndex = ServiceElementNameList[referencedobject.name];
                                    ElementIncomingElementIndexes[i].Add(elementIndex);
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary> </summary>
        public Service(IqlApiResult service, NLog.Logger logger, string originalUUID)

        {
            if (service != null && service.objectEntries != null && service.objectEntries.Count > 0)
            {
                ObjectEntry selectedEntry = service.objectEntries[0];
                if (service.objectEntries.Count > 1)
                {
                    foreach (var entry in service.objectEntries)
                    {
                        string name = entry.label;
                        if (name.Length - originalUUID.Length >= 0 && name.Length - originalUUID.Length <= 0)
                        {
                            selectedEntry = entry;
                        }
                    }
                }
                AttributeNamesByIds = new Dictionary <string, int>();
                AttributeByIds      = new Dictionary <int, ObjectAttribute>();
                AttributeIdsByNames = new Dictionary <int, string>();
                AttributeTypesByIds = new Dictionary <int, ObjectTypeAttribute>();
                foreach (var attribute in selectedEntry.attributes)
                {
                    AttributeByIds.Add(attribute.objectTypeAttributeId, attribute);
                }
                foreach (var typeAttribute in service.objectTypeAttributes)
                {
                    AttributeNamesByIds.Add(typeAttribute.name, typeAttribute.id);
                    AttributeIdsByNames.Add(typeAttribute.id, typeAttribute.name);
                    AttributeTypesByIds.Add(typeAttribute.id, typeAttribute);
                    bool                        hasThisAttribute = AttributeByIds.ContainsKey(typeAttribute.id);
                    ObjectAttribute             attribute        = AttributeByIds[typeAttribute.id];
                    List <ObjectAttributeValue> attributeValues  = attribute.ObjectAttributeValues;

                    // if all above values are valid then set fields
                    if (typeAttribute != null && AttributeByIds != null && hasThisAttribute && attribute != null &&
                        attributeValues != null && attributeValues.Count > 0 && attributeValues[0] != null)
                    {
                        switch (typeAttribute.name)
                        {
                        case "Key":
                            Key = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Name":
                            Name = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Service Confluence URL":
                            ConfluenceURL = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Status":
                            Status = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Broadcast Time":
                            BroadcastTime = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Client VPN":
                            ClientVPN = Convert.ToBoolean(typeAttribute.Label);
                            break;

                        case "UUID/TKSID":
                            UUID = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Service Owner":
                            ServiceOwner = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Content Type":
                            ContentType = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Service Category":
                            ServiceCategory = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Distribution Channel":
                            DistributionChannel = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Service Role":
                            ServiceRole = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Service Remarks(Customer Service)":
                            ServiceRemarks = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Start of Service":
                            StartofService = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "End of Service":
                            EndofService = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        case "Service Documentation Approved":
                            EndofService = AttributeByIds[typeAttribute.id].ObjectAttributeValues[0].displayValue;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }