code: public function createThread(CategoryInterface $tag, TopicInterface $thread)
      {
          $thread->setForumCategoryId($tag->getid());
          $thread->setTimestampCreated(date("Y-m-d H:i:s"));
          $thread->setUserId($this->getServiceManager()->get('zfcuser_auth_service')->getIdentity()->getId());
  
          $this->getEventManager()->trigger(
              __FUNCTION__,
              $thread,
              array(
                  'thread'  => $thread,
              )
          );
  
          $thread = $this->topicMapper->persist($thread);
  
          $this->getEventManager()->trigger(
              __FUNCTION__ . '.post',
              $thread,
              array(
                  'thread'  => $thread,
              )
          );
  
          return $thread;
      }
docs: createThread
  
  @param CategoryInterface $tag
  @param ThreadInterface $thread
  @return ThreadInterface