public async Task <IActionResult> ChangeCachePolicy(CachePolicy selectedPolicy, int?invalidateCacheTime = null) { if (selectedPolicy != CachePolicy.NeverPolicy && invalidateCacheTime == null) { return(BadRequest(ErrorView.ValidationError())); } try { await cacheSettingsManager.UpdateCachePolicy(new CacheSettings() { CachePolicy = selectedPolicy, InvalidateCacheTime = invalidateCacheTime }); return(Ok()); } catch (ArgumentOutOfRangeException) { return(BadRequest(ErrorView.ValidationError())); } catch (NotFoundDataException) { return(BadRequest(ErrorView.ServerError())); } }