public async Task <IActionResult> UploadFile(IFormFile file)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var userId = User.FindFirstValue(ClaimTypes.Name);

            try
            {
                if (file != null)
                {
                    string ext = Path.GetExtension(file.FileName);

                    var newFile = new Application.Models.Entities.File
                    {
                        Id     = ObjectId.GenerateNewId().ToString(),
                        UserId = userId
                    };

                    var fileModel = await _fileService.UploadFile(newFile, file);

                    return(Ok(fileModel));
                }
            }
            catch (Exception e)
            {
                return(BadRequest(new MessageObj(e.Message)));
            }

            return(BadRequest(new MessageObj("Couldn't upload file'")));
        }
        public async Task <File> UploadFile(File file, IFormFile formFile)
        {
            using (var storageClient = await StorageClient.CreateAsync(_credentials))
            {
                var disposition = formFile.ContentDisposition;
                var imageObject = await storageClient.UploadObjectAsync(
                    "converge-bucket",
                    file.Id + Path.GetExtension(formFile.FileName),
                    formFile.ContentType,
                    formFile.OpenReadStream(),
                    new UploadObjectOptions { PredefinedAcl = PredefinedObjectAcl.PublicRead }
                    );

                file.BucketLink = imageObject.MediaLink;

                return(await _fileRepository.Create(file));;
            }
        }