code: def ensure_primary_annotation_has_hook(annotation)
        hook = annotation.hook
        if hook.nil? then
          raise CaRuby::DatabaseError.new("Cannot save annotation #{annotation} since it does not reference a hook entity")
        end
        if hook.identifier.nil? then
          logger.debug { "Ensuring that the annotation #{annotation.qp} hook entity #{hook.qp} exists in the database..." }
          ensure_exists(hook)
        end
      end
docs: Ensures that a primary annotation hook exists.
  
   @param (see #prepare_annotation_for_save)
   @raise [CaRuby::DatabaseError] if the annotation does not reference a hook entity