private void GenerateOutput()
    {
      
      ConnectionDetails details = null;

      if (string.IsNullOrWhiteSpace(ConnectionString))
      {
        ConnectionDetails = null;
        _connectionString = "";
        OnPropertyChanged(nameof(ConnectionString));
        if(_errorsByPropertyName.ContainsKey(nameof(ConnectionString)))
        {
          _errorsByPropertyName.Remove(nameof(ConnectionString));
          OnErrorsChanged(nameof(ConnectionString));
        }
      }
      else
      {
        RemoveAnySpacesFromTheConnectionString();

        if (!ConnectionDetailsExtractor.TryExtract(ConnectionString, out details))
        {
          _errorsByPropertyName[nameof(ConnectionString)] = new List<string> { "Invalid event hub connection string. Please copy it from the Azure Portal." };
          OnErrorsChanged(nameof(ConnectionString));
        }
        else
        {
          ConnectionDetails = details;
          if(_errorsByPropertyName.ContainsKey(nameof(ConnectionString)))
          {
            _errorsByPropertyName.Remove(nameof(ConnectionString));
            OnErrorsChanged(nameof(ConnectionString));
          }
        }
      }

      int tokenLifeTimeInt;
      if (!int.TryParse(TokenLifeTime, out tokenLifeTimeInt))
      {
        _errorsByPropertyName[nameof(TokenLifeTime)] = new List<string> { "Invalid Token Lifetime. Please specify an integer" };
        OnErrorsChanged(nameof(TokenLifeTime));
      }
      else
      {
        if (_errorsByPropertyName.ContainsKey(nameof(TokenLifeTime)))
        {
          _errorsByPropertyName.Remove(nameof(TokenLifeTime));
          OnErrorsChanged(nameof(TokenLifeTime));
        }
      }

      // Note: Put this in a try-catch to find out too big values for TimeSpan
      TimeSpan tokenLifeTime = GetTokenLifeTime(tokenLifeTimeInt);

      if (!_errorsByPropertyName.Any()
        && !string.IsNullOrWhiteSpace(ConnectionString))
      {
        var generator = new RestUriAndSharedAccessSignatureGenerator(details, PublisherName, tokenLifeTime);
        SharedAccessSignature = generator.GenerateSharedAccessSignature();
        EventHubRestUri = generator.GetEventHubRestUri();

        UwpEventHubClient = new EventHubClientTemplate(SharedAccessSignature, EventHubRestUri).TransformText();
      }
      else
      {
        SharedAccessSignature = null;
        EventHubRestUri = null;
        UwpEventHubClient = null;
      }
    }
        private void GenerateOutput()
        {
            ConnectionDetails details = null;

            if (string.IsNullOrWhiteSpace(ConnectionString))
            {
                ConnectionDetails = null;
                _connectionString = "";
                OnPropertyChanged(nameof(ConnectionString));
                if (_errorsByPropertyName.ContainsKey(nameof(ConnectionString)))
                {
                    _errorsByPropertyName.Remove(nameof(ConnectionString));
                    OnErrorsChanged(nameof(ConnectionString));
                }
            }
            else
            {
                RemoveAnySpacesFromTheConnectionString();

                if (!ConnectionDetailsExtractor.TryExtract(ConnectionString, out details))
                {
                    _errorsByPropertyName[nameof(ConnectionString)] = new List <string> {
                        "Invalid event hub connection string. Please copy it from the Azure Portal."
                    };
                    OnErrorsChanged(nameof(ConnectionString));
                }
                else
                {
                    ConnectionDetails = details;
                    if (_errorsByPropertyName.ContainsKey(nameof(ConnectionString)))
                    {
                        _errorsByPropertyName.Remove(nameof(ConnectionString));
                        OnErrorsChanged(nameof(ConnectionString));
                    }
                }
            }

            int tokenLifeTimeInt;

            if (!int.TryParse(TokenLifeTime, out tokenLifeTimeInt))
            {
                _errorsByPropertyName[nameof(TokenLifeTime)] = new List <string> {
                    "Invalid Token Lifetime. Please specify an integer"
                };
                OnErrorsChanged(nameof(TokenLifeTime));
            }
            else
            {
                if (_errorsByPropertyName.ContainsKey(nameof(TokenLifeTime)))
                {
                    _errorsByPropertyName.Remove(nameof(TokenLifeTime));
                    OnErrorsChanged(nameof(TokenLifeTime));
                }
            }

            // Note: Put this in a try-catch to find out too big values for TimeSpan
            TimeSpan tokenLifeTime = GetTokenLifeTime(tokenLifeTimeInt);

            if (!_errorsByPropertyName.Any() &&
                !string.IsNullOrWhiteSpace(ConnectionString))
            {
                var generator = new RestUriAndSharedAccessSignatureGenerator(details, PublisherName, tokenLifeTime);
                SharedAccessSignature = generator.GenerateSharedAccessSignature();
                EventHubRestUri       = generator.GetEventHubRestUri();

                UwpEventHubClient = new EventHubClientTemplate(SharedAccessSignature, EventHubRestUri).TransformText();
            }
            else
            {
                SharedAccessSignature = null;
                EventHubRestUri       = null;
                UwpEventHubClient     = null;
            }
        }