/**
  * (non-PHPdoc)
  * @see ActiveSync_Frontend_Abstract::toSyncrotonModel()
  */
 public function toSyncrotonModel($entry, array $options = array())
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " email data " . print_r($entry->toArray(), true));
     }
     if (!$this->_isMemoryLeft($entry->size)) {
         throw new Syncroton_Exception_MemoryExhausted('not enough memory left for: ' . $entry->getId() . ' Needed: ' . $entry->size);
     }
     $syncrotonEmail = new Syncroton_Model_Email();
     foreach ($this->_mapping as $syncrotonProperty => $tine20Property) {
         if (empty($entry->{$tine20Property}) && $entry->{$tine20Property} != '0' || count($entry->{$tine20Property}) === 0) {
             continue;
         }
         switch ($tine20Property) {
             case 'from_email':
                 $syncrotonEmail->{$syncrotonProperty} = $this->_createEmailAddress($entry->from_name, $entry->from_email);
                 break;
             case 'to':
             case 'cc':
                 $syncrotonEmail->{$syncrotonProperty} = implode(', ', $entry->{$tine20Property});
                 break;
             default:
                 $syncrotonEmail->{$syncrotonProperty} = $entry->{$tine20Property};
                 break;
         }
     }
     $syncrotonEmail->body = $this->_getSyncrotonBody($entry, $options);
     if ($syncrotonEmail->body->type < 4) {
         $syncrotonEmail->nativeBodyType = $syncrotonEmail->body->type;
     }
     if ($syncrotonEmail->body->type == Syncroton_Command_Sync::BODY_TYPE_MIME) {
         $syncrotonEmail->messageClass = 'IPM.Note.SMIME';
     } else {
         $syncrotonEmail->messageClass = 'IPM.Note';
     }
     $syncrotonEmail->contentClass = 'urn:content-classes:message';
     // read flag
     $syncrotonEmail->read = in_array(Zend_Mail_Storage::FLAG_SEEN, $entry->flags) ? 1 : 0;
     if (in_array(Zend_Mail_Storage::FLAG_ANSWERED, $entry->flags)) {
         $syncrotonEmail->lastVerbExecuted = Syncroton_Model_Email::LASTVERB_REPLYTOSENDER;
         $syncrotonEmail->lastVerbExecutionTime = new DateTime('now', new DateTimeZone('utc'));
         #} elseif (in_array('\Forwarded', $entry->flags)) {
         #    $syncrotonEmail->lastVerbExecuted = Syncroton_Model_Email::LASTVERB_FORWARD;
         #    $syncrotonEmail->lastVerbExecutionTime = new DateTime('now', new DateTimeZone('utc'));
     }
     $syncrotonEmail->flag = in_array('\\Flagged', $entry->flags) ? new Syncroton_Model_EmailFlag(array('status' => Syncroton_Model_EmailFlag::STATUS_ACTIVE, 'flagType' => 'FollowUp', 'reminderSet' => 0, 'startDate' => Tinebase_DateTime::now(), 'utcStartDate' => Tinebase_DateTime::now(), 'dueDate' => Tinebase_DateTime::now()->addWeek(1), 'utcDueDate' => Tinebase_DateTime::now()->addWeek(1))) : new Syncroton_Model_EmailFlag(array('status' => Syncroton_Model_EmailFlag::STATUS_CLEARED));
     // attachments?
     if ($entry->has_attachment == true) {
         $syncrotonAttachments = array();
         $attachments = $this->_contentController->getAttachments($entry);
         if (count($attachments) > 0) {
             foreach ($attachments as $attachment) {
                 $syncrotonAttachment = new Syncroton_Model_EmailAttachment(array('displayName' => trim($attachment['filename']), 'fileReference' => $entry->getId() . ActiveSync_Frontend_Abstract::LONGID_DELIMITER . $attachment['partId'], 'method' => 1, 'estimatedDataSize' => $attachment['size']));
                 $syncrotonAttachments[] = $syncrotonAttachment;
             }
         }
         $syncrotonEmail->attachments = $syncrotonAttachments;
     }
     #$syncrotonEmail->categories = array('Test');
     $syncrotonEmail->conversationId = $entry->getId();
     $syncrotonEmail->conversationIndex = "";
     return $syncrotonEmail;
 }