private NewSensorParameters CreateRawParameters() { if (!RawParameters.ContainsKey(NameParameter)) { throw new InvalidOperationException($"Hashtable record '{NameParameter}' is mandatory, however a value was not specified"); } if (!RawParameters.ContainsKey(SensorTypeParameter)) { throw new InvalidOperationException($"Hashtable record '{SensorTypeParameter}' is mandatory, however a value was not specified'"); } var parameters = new PSRawSensorParameters(RawParameters[NameParameter]?.ToString(), RawParameters[SensorTypeParameter]?.ToString()); var toAdd = RawParameters.Keys.Cast <object>() .Where(k => k.ToString() != SensorTypeParameter) .Select(k => new CustomParameter(k.ToString(), PSObjectUtilities.CleanPSObject(RawParameters[k]), ParameterType.MultiParameter)) .ToList(); foreach (var param in toAdd) { parameters[param.Name] = param.Value; } if (DynamicType) { parameters.DynamicType = true; } return(parameters); }