public IdentificationParameter CreateFor(IEnumerable <ParameterSelection> parameterSelections, ParameterIdentification parameterIdentification)
        {
            //The referenced parameter could be null if for example the parameter selection points to a parameter that does not exist in the simulation anymore
            //In that case, the selection itself is invalid but the check should not crash
            var unmappedParameters = parameterSelections
                                     .Where(x => !parameterIdentification.IdentifiesParameter(x))
                                     .Where(x => x.Parameter != null).ToList();

            var parameters = unmappedParameters.Select(x => x.Parameter).ToList();

            if (!parameters.Any())
            {
                return(null);
            }

            ensureThatDimensionsAreEqual(parameters);

            var nameToUse = uniqueNameFor(parameterIdentification, parameters);

            var identificationParameter = _objectBaseFactory.Create <IdentificationParameter>().WithName(nameToUse);

            identificationParameter.UseAsFactor = false;

            _identificationParameterTask.AddParameterRangeBasedOn(identificationParameter, parameters[0]);
            identificationParameter.Scaling = defaultScalingBasedOn(parameters[0]);

            unmappedParameters.Each(identificationParameter.AddLinkedParameter);

            return(identificationParameter);
        }
        public IdentificationParameter CreateFor(IEnumerable <ParameterSelection> parameterSelections, ParameterIdentification parameterIdentification)
        {
            var unmappedParameters = parameterSelections.Where(s => !parameterIdentification.IdentifiesParameter(s)).ToList();
            var parameters         = unmappedParameters.Select(x => x.Parameter).ToList();

            if (!parameters.Any())
            {
                return(null);
            }

            ensureThatDimensionsAreEqual(parameters);

            var nameToUse = uniqueNameFor(parameterIdentification, parameters);

            var identificationParameter = _objectBaseFactory.Create <IdentificationParameter>().WithName(nameToUse);

            identificationParameter.UseAsFactor = false;

            _identificationParameterTask.AddParameterRangeBasedOn(identificationParameter, parameters[0]);
            identificationParameter.Scaling = defaultScalingBasedOn(parameters[0]);

            unmappedParameters.Each(identificationParameter.AddLinkedParameter);

            return(identificationParameter);
        }