public async Task UpdateExistEntity_Test()
        {
            // Arrange
            var originalTokenDescriptor = GenerateTokenDescriptor();
            var issuer   = originalTokenDescriptor.Issuer;
            var audience = originalTokenDescriptor.Audience;

            var addedResult = await _tokenRepository.AddAsync(originalTokenDescriptor);

            addedResult.Should().BeTrue();

            var newTokenDescriptor = GenerateTokenDescriptor();

            // Act
            var result = await _tokenRepository.AddOrUpdateAsync(issuer, audience, newTokenDescriptor);

            // Assert
            result.Should().BeTrue();

            var resultOfUpdate = await _tokenRepository.GetAsync(issuer, audience);

            resultOfUpdate.Should().NotBeNull();
            newTokenDescriptor.Issuer   = issuer;
            newTokenDescriptor.Audience = audience;

            BeEquivalentTo(resultOfUpdate, newTokenDescriptor);
        }
        public async Task AddOrUpdateTokenAsync(TokenDescriptor tokenDescriptor, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrWhiteSpace(tokenDescriptor.PrivateKey))
            {
                tokenDescriptor.PrivateKey = _passwordProvider.GetNextStringPassword(ValidationConstants.MaxPasswordLength);
            }

            _tokenDescriptorModelValidator.EnsureValidation(tokenDescriptor);

            await _tokenRepository.AddOrUpdateAsync(tokenDescriptor.Issuer, tokenDescriptor.Audience, tokenDescriptor, cancellationToken);

            _notifier.Notify(new TokenUpdatedNotifyMessage(tokenDescriptor.Issuer, tokenDescriptor.Audience, tokenDescriptor.Ttl, tokenDescriptor.ExpirationDate, tokenDescriptor.IsActive));
        }