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

            if (user == null)
            {
                throw new UserNotFoundException("User not found");
            }
            var file = await _fileRepository.GetOneByAsync(f => f.Id == id && f.user.Id == userId);

            if (file == null)
            {
                throw new ResourceNotFoundException("File to delete not found");
            }

            _fileWriter.DeleteFileFromServer(file.FileNameOnServer, userId);
            var result = _fileRepository.Delete(file);

            await _fileRepository.SaveAsync();

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

            return(resultDto);
        }