public async Task <HttpResponseMessage> TinyTImage(int itemId) { _settingsService.CheckIfSettingExists(); var imagesList = new List <TImage>(); var image = _imageService.GetImageById(itemId); _imageService.CheckExtension(image.Name); var imageHistory = _historyService.GetHistoryForImage(image.Id); if (imageHistory != null) { if (imageHistory.IsOptimized) { return(Request.CreateResponse(HttpStatusCode.BadRequest, PackageConstants.AlreadyOptimized)); } } imagesList.Add(image); var responseMessage = await CallTinyPngService(imagesList); return(responseMessage); }