public function createTopic(TopicInterface $topic, PostInterface $post, $user)
 {
     $socialContext = $topic->getSocialContext();
     // ** Set post properties.
     $this->logger->debug("Assigning author and topic reference to post.");
     $post->setAuthor($user);
     $post->setTopic($topic);
     $post->setSocialContext($socialContext);
     // ** Set topic properties.
     $this->logger->debug("Creating reference to post on topic.");
     $topic->setPost($post);
     $topic->setLastPost($post);
     $topic->setUser($user);
     // ** Update/persist the topic.
     $this->update($topic);
     return $topic;
 }
 public function createPost(PostInterface $post, TopicInterface $topic, $user)
 {
     $socialContext = $topic->getSocialContext();
     $post->setAuthor($user);
     $post->setSocialContext($socialContext);
     $post->setTopic($topic);
     $this->update($post);
     return $post;
 }