private static CacheItem CreateCacheItem( PersistedGrant entity) { CacheItem item = new CacheItem(entity); item.Tags = GetTags(entity); if (entity.GetExpiration().HasValue) { TimeSpan span = entity.GetExpiration().Value - DateTime.UtcNow; item.Expiration = new Expiration(ExpirationType.Absolute, span); } return(item); }