protected function action()
 {
     $headers = ['Content-Type' => $this->resourceDO->getMimeType()];
     $filePath = $this->resourceDO->getFilePath();
     $fileExists = is_file($filePath);
     $recreate = PrepareResourceMiddlewareAbstract::getParamFromRequest(static::RECREATE_COMMAND, $this->request);
     $uri = PrepareResourceMiddlewareAbstract::getParamFromRequest(static::URI_COMMAND, $this->request);
     $recreate = $fileExists && $recreate;
     $this->resourceDO->setNew(!$fileExists);
     if (!$fileExists || $recreate) {
         $this->resourceDO->setRecreate($recreate);
         $upload = $this->upload();
         // Upload must be with high priority
         if ($upload) {
             /** @see \Zend\Diactoros\Response::$phrases */
             return new FileUploadedResponse($upload, 201, $headers);
         } elseif ($uri) {
             $upload = $this->download($this->resourceDO, $uri);
             /** @see \Zend\Diactoros\Response::$phrases */
             return new FileUploadedResponse($upload, 201, $headers);
         } else {
             $body = $this->generate($this->resourceDO);
             /** @see \Zend\Diactoros\Response::$phrases */
             return new FileContentResponse($body, 201, $headers);
         }
     }
     /** @see \Zend\Diactoros\Response::$phrases */
     return new EmptyResponse(304, $headers);
 }