public IActionResult CreateZip(string f, bool collections = true, bool thumbnail = false) { var inputFilePaths = PathHelper.SplitInputFilePaths(f); var(zipOutputName, fileIndexResultsList) = _export.Preflight(inputFilePaths, collections, thumbnail); // When all items are not found // allow read only if (fileIndexResultsList.All(p => p.Status != FileIndexItem.ExifStatus.Ok)) { return(NotFound(fileIndexResultsList)); } // NOT covered: when try to export for example image thumbnails of xml file // Creating a zip is a background task _bgTaskQueue.QueueBackgroundWorkItem(async token => { await _export.CreateZip(fileIndexResultsList, thumbnail, zipOutputName); }); // for the rest api return(Json(zipOutputName)); }