/**
  * Update annotation by id 
  * 
  * @action update
  * @param string $id
  * @param KalturaAnnotation $annotation
  * @return KalturaAnnotation
  */
 function updateAction($id, KalturaAnnotation $annotation)
 {
     kalturalog::debug("annotation service updateAction");
     $dbAnnotation = AnnotationPeer::retrieveByPK($id);
     if ($dbAnnotation->getType() != AnnotationType::ANNOTATION) {
         throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $id);
     }
     if (!$dbAnnotation) {
         throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $id);
     }
     if ($annotation->text !== null) {
         $annotation->validatePropertyMaxLength("text", AnnotationPeer::MAX_ANNOTATION_TEXT);
     }
     if ($annotation->tags !== null) {
         $annotation->validatePropertyMaxLength("tags", AnnotationPeer::MAX_ANNOTATION_TAGS);
     }
     if ($annotation->entryId !== null) {
         $annotation->validateEntryId($annotation, $id);
     }
     if ($annotation->parentId !== null) {
         $annotation->validateParentId($annotation, $id);
     }
     if ($annotation->startTime !== null) {
         $annotation->validateStartTime($annotation, $id);
     }
     if ($annotation->endTime !== null) {
         $annotation->validateEndTime($annotation, $id);
     }
     $dbAnnotation = $annotation->toUpdatableObject($dbAnnotation);
     $dbAnnotation->setKuserId($this->getKuser()->getId());
     $dbAnnotation->save();
     $annotation->fromObject($dbAnnotation);
     return $annotation;
 }