function parameterSettings = checkParametersForCompile(model, parameterSettings)
% This method updates configuration parameter value. It is caller's responsibility to
% ensure that its called on correct model and model has the required
% configset set as active (make sure that original configset is not getting modified). 

%   Copyright 2010-2021 The MathWorks, Inc.

    newparameterSettings = parameterSettings;
    parametersToChange = fieldnames(parameterSettings);
    for idx=1:length(parametersToChange)
        newparamConfig = parameterSettings.(parametersToChange{idx});
        actualParamValue = get_param(model, parametersToChange{idx});

        if ~strcmp(actualParamValue,newparamConfig.newvalue)
            Sldv.utils.settingsValueHandler({{parametersToChange{idx},newparamConfig.newvalue}}, model, false);
            newparameterSettings.(parametersToChange{idx}).originalvalue = actualParamValue;
        else
            newparameterSettings = rmfield(newparameterSettings,parametersToChange{idx});
        end
    end        
    parameterSettings = newparameterSettings;
end
