public function saveMail($mail)
    {
        // first save file to spool path
        // to avoid exceptions on external storage provider connection

        // convert message to json
        $mailJson = json_encode($mail);

        $this->createFolder(
            $this->getMailFolderPathById($mail->getId())
        );

        // try to store message to filesystem
        return $this->storeFile(
            $mailJson,
            $this->getMailFolderPathById($mail->getId()) .
                DIRECTORY_SEPARATOR . self::MAIL_FILE_NAME
        );
    }