$permission->Redirect(FALSE);
         //Redirect
     }
     if (isset($object_type_id) and isset($object_id)) {
         if (!isset($parent_id)) {
             $parent_id = 0;
         }
         $mf->setObjectType($object_type_id);
         $mf->setObject($object_id);
         $mf->setParent($parent_id);
         $mf->setPriority();
         $mf->setStatus('UNREAD');
         $mf->setSubject($message_data['subject']);
         $mf->setBody($message_data['body']);
         if ($mf->isValid()) {
             $mf->Save();
             Redirect::Page(URLBuilder::getURL(array('template' => $template, 'close' => 1, 'object_type_id' => $object_type_id, 'object_id' => $object_id), 'EmbeddedMessageList.php'));
             break;
         }
     }
 default:
     if (isset($object_type_id) and isset($object_id)) {
         $mlf = new MessageListFactory();
         $mlf->getByObjectTypeAndObject($object_type_id, $object_id);
         $i = 0;
         foreach ($mlf as $message) {
             //Get user info
             $ulf = new UserListFactory();
             $messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type' => $message->getObjectType(), 'object_id' => $message->getObject(), 'priority' => $message->getPriority(), 'status' => $message->getStatus(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'created_by_full_name' => $ulf->getById($message->getCreatedBy())->getCurrent()->getFullName(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
             //Mark own messages as read.
             if ($message->getCreatedBy() != $current_user->getId()) {
 function postSave()
 {
     //Save message here after we have the request_id.
     //if ( $this->isNew() == TRUE ) {
     if ($this->getMessage() !== FALSE) {
         $mf = new MessageFactory();
         $mf->setObjectType(50);
         //Request
         $mf->setObject($this->getID());
         $mf->setParent(0);
         $mf->setPriority();
         $mf->setStatus('UNREAD');
         $mf->setBody($this->getMessage());
         if ($mf->isValid()) {
             return $mf->Save();
         }
     }
     return TRUE;
 }