public JsonResult Add(FileJsonRequestModel fileJson) { var uploadingFile = new File { TraineeProfileId = fileJson.ProfileId, Name = fileJson.File?.FileName, Size = fileJson.File?.ContentLength ?? 0, Description = fileJson.Description.TrimAndUppercaseFirst(), FileData = new FileData { Id = fileJson.Id, Data = fileJson.GetFileData() } }; var addedFile = _fileProvider.AddFile(uploadingFile); var addedFileJsonModel = new FileJsonResponseModel { Id = addedFile.Id, Name = addedFile.Name, Description = addedFile.Description, Size = addedFile.Size }; return(Json(addedFileJsonModel)); }