public async Task <FileDto> Upload(IFormFile file, int userId)
        {
            var user = await _userRepository.GetOneByIdAsync(userId);

            if (user == null)
            {
                throw new UserNotFoundException("User not found!");
            }

            var fileExtension    = _fileWriter.GetFileExtension(file);
            var fileNameOnServer = await _fileWriter.SaveFileOnServer(file, userId);

            var fileEntity = new File();

            fileEntity.FileName         = _fileWriter.GetFileNameWithoutExtension(file);
            fileEntity.FileNameOnServer = fileNameOnServer;
            fileEntity.Extension        = fileExtension;
            fileEntity.FileSize         = file.Length;
            fileEntity.user             = user;

            var result = await _fileRepository.CreateAsync(fileEntity);

            await _fileRepository.SaveAsync();

            var fileDto = _mapper.Map <File, FileDto>(result);

            return(fileDto);
        }