private void UpdateGlobalOptionSet()
        {
            OptionSetMetadataBase optionSet = _repository.GetOptionSet(OptionSet);

            // Can be new or update
            if (IsNewOptionSetValue(optionSet, Value))
            {
                _repository.AddOptionSetValue(OptionSet, DisplayName, Value, Description);
            }
            else
            {
                _repository.UpdateOptionSetValue(OptionSet, Value.Value, DisplayName, Description);
            }
        }
        private void UpdateGlobalOptionSet()
        {
            int? newValue = Value;
            bool isNew    = true;

            // Can be new or update
            OptionSetMetadataBase optionSet = _repository.GetOptionSet(OptionSet);

            if (optionSet is OptionSetMetadata)
            {
                OptionSetMetadata localOptionSet = optionSet as OptionSetMetadata;
                if (localOptionSet.Options.Any(o => o.Value.Value.Equals(Value.Value)))
                {
                    // Existing; Do update
                    isNew = false;
                }
            }
            else if (optionSet is BooleanOptionSetMetadata)
            {
                BooleanOptionSetMetadata localOptionSet = optionSet as BooleanOptionSetMetadata;
                if (localOptionSet.TrueOption.Value.Equals(Value.Value) || localOptionSet.FalseOption.Value.Equals(Value.Value))
                {
                    // Existing; Do update
                    isNew = false;
                }
            }

            if (isNew)
            {
                newValue = _repository.AddOptionSetValue(OptionSet, DisplayName, Value, Description);
            }
            else
            {
                _repository.UpdateOptionSetValue(OptionSet, Value.Value, DisplayName, Description);
            }
        }