public async Task PutAsync <T>(T entity) where T : Cacheable { var storedCache = await cacheRepository.GetCache(GetNewCache <T>()); if (storedCache != null) { ReplaceData <T>(ref storedCache, entity); await cacheRepository.UpdateCache(storedCache); } else { await cacheRepository.AddCache(GetNewCache <T>(entity)); } }