/// <summary>
            /// Inport parameters to the DB.
            /// </summary>
            /// <param name="target">Device, Category, Table or property that parameters are saved.</param>
            /// <param name="id">Target ID.</param>
            /// <param name="parent">Parent template.</param>
            /// <param name="items">Keyvalue pair template who owns the parameter and value of the parameter.</param>
            void ImportParameters(object target, ulong id, object parent, List <object[]> items)
            {
                DataMemberAttribute dma = new DataMemberAttribute();
                object value;

                foreach (PropertyDescriptor it in TypeDescriptor.GetProperties(target))
                {
                    if (it.Name == "DisabledActions")
                    {
                        continue;
                    }
                    //If value is not stored.
                    DataMemberAttribute dm = it.Attributes[typeof(DataMemberAttribute)] as DataMemberAttribute;
                    if (dm == null)
                    {
                        continue;
                    }
                    ValueAccessAttribute va = it.Attributes[typeof(ValueAccessAttribute)] as ValueAccessAttribute;
                    if (va == null || va.RunTime != ValueAccessType.Edit)
                    {
                        continue;
                    }
                    //Save default value.
                    value = it.GetValue(target);
                    GXAmiParameterTemplate param = new GXAmiParameterTemplate();
                    param.ParentID = id;
                    param.Name     = it.Name;
                    param.Value    = value;
                    // param.Description
                    if (it.PropertyType == typeof(object) && param.Value != null)
                    {
                        param.Type = param.Value.GetType();
                    }
                    else
                    {
                        param.Type = it.PropertyType;
                    }
                    //If parameter is enum add possible values to the DB.
                    if (it.PropertyType.IsEnum)
                    {
                        List <GXAmiValueItem> values = new List <GXAmiValueItem>();
                        foreach (string val in Enum.GetNames(it.PropertyType))
                        {
                            GXAmiValueItem vi = new GXAmiValueItem();
                            //Parameter ID is updated after parameter template is saved to the DB.
                            vi.ParameterId = 0;
                            vi.UIValue     = val;
                            values.Add(vi);
                        }
                        param.Values = values.ToArray();
                    }
                    param.Storable = it.Attributes.Contains(dma);
                    param.Access   = va.RunTime;
                    items.Add(new object[] { parent, param });
                }
            }
 /// <summary>
 /// Inport parameters to the DB.
 /// </summary>
 /// <param name="target">Device, Category, Table or property that parameters are saved.</param>
 /// <param name="id">Target ID.</param>
 /// <param name="parent">Parent template.</param>
 /// <param name="items">Keyvalue pair template who owns the parameter and value of the parameter.</param>
 void ImportParameters(object target, ulong id, object parent, List<object[]> items)
 {
     DataMemberAttribute dma = new DataMemberAttribute();
     object value;
     foreach (PropertyDescriptor it in TypeDescriptor.GetProperties(target))
     {
         if (it.Name == "DisabledActions")
         {
             continue;
         }
         //If value is not stored.
         DataMemberAttribute dm = it.Attributes[typeof(DataMemberAttribute)] as DataMemberAttribute;
         if (dm == null)
         {
             continue;
         }
         ValueAccessAttribute va = it.Attributes[typeof(ValueAccessAttribute)] as ValueAccessAttribute;
         if (va == null || va.RunTime != ValueAccessType.Edit)
         {
             continue;
         }
         //Save default value.
         value = it.GetValue(target);
         GXAmiParameterTemplate param = new GXAmiParameterTemplate();
         param.ParentID = id;                    
         param.Name = it.Name;
         param.Value = value;
         // param.Description
         if (it.PropertyType == typeof(object) && param.Value != null)
         {
             param.Type = param.Value.GetType();
         }
         else
         {
             param.Type = it.PropertyType;
         }
         //If parameter is enum add possible values to the DB.
         if (it.PropertyType.IsEnum)
         {
             List<GXAmiValueItem> values = new List<GXAmiValueItem>();
             foreach(string val in Enum.GetNames(it.PropertyType))
             {
                 GXAmiValueItem vi = new GXAmiValueItem();
                 //Parameter ID is updated after parameter template is saved to the DB.
                 vi.ParameterId = 0;
                 vi.UIValue = val;
                 values.Add(vi);
             }
             param.Values = values.ToArray();
         }
         param.Storable = it.Attributes.Contains(dma);
         param.Access = va.RunTime;
         items.Add(new object[] { parent, param });
     }
 }