private function createPostFromParameters(CreatePostParameters $createPostParameters) : Post { $postType = $this->postTypeFactory->createPostTypeByIntCode($createPostParameters->getPostTypeCode()); $collection = $this->collectionService->getCollectionById($createPostParameters->getCollectionId()); $profile = $this->profileService->getProfileById($createPostParameters->getProfileId()); $post = new Post($postType, $profile, $collection, $createPostParameters->getContent()); $post->setAttachmentIds($createPostParameters->getAttachmentIds()); $post->setThemeIds($collection->getThemeIds()); $this->postRepository->createPost($post); return $post; }