private function saveMetaData($size, $offset = 0, $isFinal = false, $isPartial = false) {
        $this->setMetaDataValue($this->getUserUuid(), 'ID', $this->getUserUuid());
        $this->metaData['ID'] = $this->getUserUuid();
        $this->metaData['Offset'] = $offset;
        $this->metaData['IsPartial'] = (bool) $isPartial;
        $this->metaData['IsFinal'] = (bool) $isFinal;

        if ($this->metaData['Size'] === 0) {
            $this->metaData['Size'] = $size;
        }

        if (empty($this->metaData['FileName'])) {
            $this->metaData['FileName'] = $this->getRealFileName();
            $info = new \SplFileInfo($this->getRealFileName());
            $ext = $info->getExtension();
            $this->metaData['Extension'] = $ext;
        }
        if ($isFinal) {
            $this->metaData['MimeType'] = FileToolsService::detectMimeType(
                $this->directory . $this->getUserUuid(),
                $this->getRealFileName()
            );
        }

        $json = Json::encode($this->metaData);
        file_put_contents($this->directory . $this->getUserUuid() . '.info', $json);
    }