protected function handleChunkedUpload(UploadedFile $file, ResponseInterface $response, Request $request)
    {
        // get basic container stuff
        $chunkManager = $this->container->get('oneup_uploader.chunk_manager');

        // get information about this chunked request
        [$last, $uuid, $index, $orig] = $this->parseChunkedRequest($request);

        $chunk = $chunkManager->addChunk($uuid, $index, $file, $orig);

        if (null !== $chunk) {
            $this->dispatchChunkEvents($chunk, $response, $request, $last);
        }

        if ($chunkManager->getLoadDistribution()) {
            $chunks = $chunkManager->getChunks($uuid);
            $assembled = $chunkManager->assembleChunks($chunks, true, $last);

            if (null === $chunk) {
                $this->dispatchChunkEvents($assembled, $response, $request, $last);
            }
        }

        // if all chunks collected and stored, proceed
        // with reassembling the parts
        if ($last) {
            if (!$chunkManager->getLoadDistribution()) {
                $chunks = $chunkManager->getChunks($uuid);
                $assembled = $chunkManager->assembleChunks($chunks, true, true);
            }

            $path = $assembled->getPath();

            $this->handleUpload($assembled, $response, $request);

            $chunkManager->cleanup($path);
        }
    }