public async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant) { var existsGrant = await _repository.GetByKeyAsync(grant.Key); var persistedGrant = new Core.Entities.PersistedGrant { Key = grant.Key, Type = grant.Type, SubjectId = grant.SubjectId, SessionId = grant.SessionId, ClientId = grant.ClientId, Description = grant.Description, CreationTime = grant.CreationTime, Expiration = grant.Expiration, ConsumedTime = grant.ConsumedTime, Data = grant.Data }; try { if (existsGrant == null) { Log.Debug("{persistedGrantKey} not found in database", grant.Key); await _repository.InsertAsync(persistedGrant); } else { Log.Debug("{persistedGrantKey} found in database", grant.Key); await _repository.UpdateAsync(persistedGrant); } } catch (Exception ex) { Log.Error($"PersistedGrantStore >> StoreAsync Error: {ex.Message}"); } }