     (let [foxml (f/foxml mods oai_dcs full-file preview-file
                          {:uuid uuid 
                           :label "ahoj"
-                          :created (t/now)
-                          :last-modified (t/now)
+                          :created (lt/local-now)
+                          :last-modified (lt/local-now)
                           })
           out-file (io/file result-dir (str uuid ".xml"))
           ]
       (spit out-file (u/emit foxml))
-      (fs/copy-dir (io/file workdir "payload" "first-page") result-dir)
-      (fs/copy (io/file workdir "payload" "edeposit-url.txt") (io/file result-dir "edeposit-url.txt"))
+      (fs/copy-dir (io/file workdir "request" "payload" "first-page") result-dir)
+      (fs/copy (io/file workdir "request" "payload" "edeposit-url.txt") 
+               (io/file result-dir "edeposit-url.txt"))
       [uuid workdir])))
 
 (defn make-zip-package

(defn save-request
  "it returns name of a directory where payload is saved"
  [[[metadata payload] workdir]]
  (spit (io/file workdir "payload.bin") payload)
  (.mkdir (io/file workdir "payload"))
  (spit (io/file workdir "metadata.clj") metadata)
  (let [msg (json/read-str (String. payload) :key-fn keyword) 
        marcxml-file (io/file  workdir "payload" "oai_marc.xml")]
    (log/info "save export request to" workdir)  
    (spit (-> marcxml-file .toString (.concat ".b64")) (:b64_marcxml msg))
    (spit (io/file workdir "payload" "uuid") (:uuid msg))
    (spit (io/file workdir "payload" "urnnbn") (:urnnbn msg))
    (spit (io/file workdir "payload" "aleph_id") (:aleph_id msg))
    (spit (io/file workdir "payload" "isbn") (:isbn msg))
    (spit (io/file workdir "payload" "location-at-kramerius") (:location_at_kramerius msg))
    (spit (io/file workdir "payload" "is-private") (:is_private msg))
    (spit (io/file workdir "payload" "edeposit-url.txt") (:edeposit_url msg))
    (with-open [out (io/output-stream marcxml-file)]
      (.write out (Base64/decodeBase64 (:b64_marcxml msg))))
    
    (let [out-dir (io/file workdir "payload" "first-page")
          first-page (-> msg :first_page)
          ]
      (.mkdir out-dir)

      [metadata payload workdir]
      )
    )
  )

(defn save-response-from-export-to-storage
  [metadata ^bytes payload]
  (let [msg (json/read-str (String. payload) :key-fn keyword)
        workdir (io/file (-> metadata :headers (get "UUID")))]
    (if (.exists workdir)
      (let [response-dir (io/file workdir "export-to-storage" "response")]
        (fs/mkdirs (io/file response-dir "payload"))
        (spit (io/file response-dir "metadata.clj") (s/serialize metadata s/clojure-content-type))
        (io/copy payload (io/file response-dir "payload.bin"))
        [msg workdir])
      (do
        (log/error "workdir:" (.toString workdir) "doesnot exists!")
        [msg nil])
      )
    )
  )

(defn prepare-scp-to-kramerius
  [[{:keys [dir_pointer] :as msg} workdir] & {:keys [import-mount archive-mount originals-mount]}]
  {:pre [(some? import-mount)
         (some? archive-mount)
         (some? originals-mount)
         ]}
  (let [uuid (slurp (io/file workdir "request" "payload" "uuid"))]
    (let [request-dir (io/file workdir "scp-to-kramerius" "request")
          foxml-fname (str uuid ".xml")]
      (fs/mkdirs request-dir)
      (spit (io/file workdir "scp-to-kramerius" "dir_pointer") dir_pointer)
      (spit (io/file request-dir "from") (.toString (io/file request-dir foxml-fname)))
      (spit (io/file request-dir "to")
            (str "/" 
                 (cs/join "/" 
                          (map (fn [path] (-> path 
                                             (cs/replace #"^file:" "") 
                                             (cs/replace #"^[/]+"  "")))
                               [import-mount foxml-fname]))))
      (let [root (-> (io/file workdir uuid foxml-fname)
                     io/input-stream
                     x/parse)]
        (-> root
            (f/update-rels archive-mount dir_pointer originals-mount)
            u/emit
            (io/copy (io/file request-dir foxml-fname)))
        )
      )
    [workdir]
    )
  )

(defn scp-to-kramerius
  [[workdir] {:keys [scp]}]
  "scp is a function: (fn [from-path to-path])"
  (let [out-dir (io/file workdir "scp-to-kramerius" "response")
        request-dir (io/file workdir "scp-to-kramerius" "request")
        to-path (slurp (io/file request-dir "to"))
        from-path (slurp (io/file request-dir "from"))
        ]
    (fs/mkdirs out-dir)
    (let [result (scp from-path to-path)]
      (spit (io/file out-dir "result") result)
      (spit (io/file out-dir "sent") (.toString (lt/local-now)))
      )
    )
  [workdir]
  )

(defn parse-and-export [metadata ^bytes payload]
