private static Dictionary <string, BLE_PropertyDataModel> CreatePropertiesDictionary(IReadOnlyDictionary <string, object> propertyDict)
        {
            Dictionary <string, BLE_PropertyDataModel> properties = new Dictionary <string, BLE_PropertyDataModel>();

            if (propertyDict != null)
            {
                foreach (var p in propertyDict)
                {
                    BLE_PropertyDataModel model = new BLE_PropertyDataModel()
                    {
                        Key    = p.Key,
                        Target = GetPropertyTarget(p.Key),
                    };
                    SetPropertyValue(p.Value, model);
                    if (!properties.ContainsKey(model.Key))
                    {
                        properties.Add(model.Key, model);
                    }
                    else
                    {
                        log.Error(9999, "CreatePropertiesDictionary", () => string.Format("Duplicate property key '{0}'", model.Key));
                    }
                }
            }
            return(properties);
        }
 private static void SetPropertyValue(object value, BLE_PropertyDataModel model)
 {
     if (value == null)
     {
         model.DataType = PropertyDataType.TypeString;
         model.Value    = "";
     }
     else
     {
         model.Value = value;
         if (value is bool)
         {
             model.DataType = PropertyDataType.TypeBool;
         }
         else if (value is string)
         {
             model.DataType = PropertyDataType.TypeString;
         }
         else if (value is Guid)
         {
             model.DataType = PropertyDataType.TypeGuid;
         }
         else
         {
             model.DataType = PropertyDataType.TypeUnknown;
         }
     }
 }