public Task StoreAsync(PersistedGrant token)
        {
            try
            {
                var existing = _repository.AllAsync.SingleOrDefault(x => x.Key == token.Key);
                if (existing == null)
                {
                    _logger.LogDebug($"{token.Key} not found in database");

                    var persistedGrant = token.ToEntity();
                    _repository.AddAsync(persistedGrant);
                }
                else
                {
                    _logger.LogDebug($"{token.Key} found in database");

                    existing = token.ToEntity();
                    _repository.UpdateAsync(x => x.Key == token.Key, existing);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(0, ex, "Exception storing persisted grant");
            }

            return(Task.FromResult(0));
        }