public ActionResult Scan(ScanForm command, IScannerManager scannerManager) { var scanResult = new ScanCommand(command, scannerManager).Execute(_markerAsync); if (scanResult.Validate()) { return new ActionResult { Content = scanResult.Content, ContentType = "text/json" } } ; throw new Exception(scanResult.Error); }