public function updateActivity($memberId, $body, $options = array())
 {
     $object = new ActivityData();
     $object->setMemberId($memberId);
     $object->setBody($body);
     if (isset($options['public_flag'])) {
         $publicFlagKeys = array_keys($this->getPublicFlags(false));
         if (!in_array($options['public_flag'], $publicFlagKeys)) {
             throw new LogicException('Invalid public flag');
         }
         $object->setPublicFlag($options['public_flag']);
     }
     if (isset($options['in_reply_to_activity_id'])) {
         $object->setInReplyToActivityId($options['in_reply_to_activity_id']);
     }
     if (isset($options['is_pc']) && !$options['is_pc']) {
         $object->setIsPc(false);
     }
     if (isset($options['is_mobile']) && !$options['is_mobile']) {
         $object->setIsMobile(false);
     }
     if (isset($options['uri'])) {
         $object->setUri($options['uri']);
     }
     if (isset($options['source'])) {
         $object->setSource($options['source']);
         if (isset($options['source_uri'])) {
             $object->setSourceUri($options['source_uri']);
         }
     }
     $activityImages = array();
     if (isset($options['images'])) {
         if (!is_array($options['images'])) {
             $options['images'] = array($options['images']);
         }
         foreach ($options['images'] as $image) {
             $activityImage = new ActivityImage();
             if (isset($image['file_id'])) {
                 $activityImage->setFileId($image['file_id']);
             } elseif (isset($image['uri']) && isset($image['mime_type'])) {
                 $activityImage->setUri($image['uri']);
                 $activityImage->setMimeType($image['mime_type']);
             } else {
                 throw new LogicException('Invalid image data');
             }
             $activityImages[] = $activityImage;
         }
     }
     if (isset($options['foreign_table']) && isset($options['foreign_id'])) {
         $object->setForeignTable($options['foreign_table']);
         $object->setForeignId($options['foreign_id']);
     }
     $object->save();
     foreach ($activityImages as $activityImage) {
         $activityImage->setActivityData($object);
         $activityImage->save();
     }
     return $object;
 }