public ResultModel ConvertFile(ConversionDto conversionDto)
        {
            var fileNames = _storageRepository.ParseNames(conversionDto.sessionId);

            if (fileNames == null)
            {
                return(ResultModel.Error(fileNames.Id, "Invalid session id", 400));
            }
            return(OpConvert.Measure(fileNames.Id, () =>
            {
                FileFormat fmt;
                if (conversionDto.outputType != null && formats.TryGetValue(conversionDto.outputType, out fmt))
                {
                    SceneImportContext importContext = CreateLoadContext(fileNames);
                    //User uploaded an unsupported file format.
                    if (importContext.SourceFormat == null)
                    {
                        _logger.LogError("Failed to detect file type from file {0}", fileNames.Id);
                        return ResultModel.Error(fileNames.Id, "Unsupported input file", 400);
                    }

                    Scene scene;
                    try
                    {
                        scene = importContext.LoadScene();
                    }
                    catch (Exception e)
                    {
                        _logger.LogError(e, "Failed to open input file {0}", fileNames.Id);
                        OperationFailed(e);
                        return ResultModel.Error(fileNames.Id, "Internal server error", 500);
                    }
                    var originalFile = importContext.MainFile;
                    try
                    {
                        var fileName = fileNames[OutputFile];
                        using (var stream = LimitedStream.CreateFile(fileName, MaximumOutputSize))
                        {
                            scene.Save(stream, fmt);
                        }
                    }
                    catch (Exception e)
                    {
                        var msg = "Internal server error";
                        if (e is ExportException)
                        {
                            msg = e.Message;
                        }
                        _logger.LogError(e, "Failed to save converted file to {0}", fileNames[SourceFile]);
                        OperationFailed(e);
                        return ResultModel.Error(fileNames.Id, msg, 500);
                    }
                    var newFileName = Path.ChangeExtension(originalFile, fmt.Extension);
                    importContext.MetaData.OutputFile = newFileName;
                    SetMetaData(fileNames, importContext.MetaData);
                    return ResultModel.Ok(true);
                }
                return ResultModel.Error(fileNames.Id, "Output type not found", 400);
            }));
        }