private void createFormulaForBlackBoxParameters(ICoreCalculationMethod calculationMethod, IList <IMoleculeBuilder> allMoleculesUsingMethod)
        {
            foreach (var formula in calculationMethod.AllOutputFormulas())
            {
                var parameterDescriptor = calculationMethod.DescriptorFor(formula);
                foreach (var molecule in allMoleculesUsingMethod)
                {
                    foreach (var parameter in allMoleculeParameterForFormula(parameterDescriptor, molecule))
                    {
                        //not a black box parameter. Should not be overridden by cm
                        if (parameterIsNotBlackBoxParameter(parameter))
                        {
                            continue;
                        }

                        //parmeter formula was not set yet
                        if (parameter.Formula.IsBlackBox())
                        {
                            parameter.Formula = _formulaMapper.MapFrom(formula, _buildConfiguration);
                            replaceKeyWordsIn(parameter, molecule.Name);
                        }
                        else
                        {
                            if (!formulasAreTheSameForParameter(parameter, formula, molecule.Name))
                            {
                                throw new OSPSuiteException(Error.TwoDiffentFormulaForSameParameter(parameter.Name, _objectPathFactory.CreateAbsoluteObjectPath(parameter).ToPathString()));
                            }
                        }
                    }
                }
            }
        }
 private void addHelpParametersFor(ICoreCalculationMethod calculationMethod, IList <IMoleculeBuilder> allMoleculesUsingMethod)
 {
     foreach (var helpParameter in calculationMethod.AllHelpParameters())
     {
         var containerDescriptor = calculationMethod.DescriptorFor(helpParameter);
         foreach (var molecule in allMoleculesUsingMethod)
         {
             foreach (var container in allMoleculeContainersFor(containerDescriptor, molecule))
             {
                 var exisitingParameter = container.GetSingleChildByName <IParameter>(helpParameter.Name);
                 //does not exist yet
                 if (exisitingParameter == null)
                 {
                     var parameter = _parameterMapper.MapFrom(helpParameter, _buildConfiguration);
                     container.Add(parameter);
                     replaceKeyWordsIn(parameter, molecule.Name);
                 }
                 else if (!formulasAreTheSameForParameter(exisitingParameter, helpParameter.Formula, molecule.Name))
                 {
                     throw new OSPSuiteException(Error.HelpParameterAlreadyDefinedWithAnotherFormula(calculationMethod.Name, _objectPathFactory.CreateAbsoluteObjectPath(helpParameter).ToString()));
                 }
             }
         }
     }
 }