private CustomParamValue CreateItem(CustomParam cp, decimal?parentCpvId) { var cpv = (CustomParamValue)Activator.CreateInstance(typeof(T)); cpv.CPVID = --_cpvid; cpv.CustomParamCode = cp.GetKey <string>(); cpv.CPV2Entity = CpEntity; cpv.CPVKey = CpKey; cpv.CPVValue = cp.CustomParamDefault; cpv.VCustomParamParent = cp.CustomParamParent; cpv.Cp = cp; cpv.FormattedValue = CpvHelper.GetFormattedValue(cpv); cpv.CPVParent = parentCpvId; cpv.VCustomParamCount = cp.CustomParamCount; cpv.VCustomParamDesc = cp.CustomParamDesc; return(cpv); }