/**
  * Create a new article
  *
  * @param  array                           $data
  * @param  string                          $language
  * @return string|\App\Core\Models\Article
  */
 public function create($input_data)
 {
     $data = $this->prepareData($input_data);
     $article = new Article();
     $article->setArticleIsPublished($data['article_is_published']);
     $articleTranslations = array();
     //Create all the ArticleTranslations for the Article
     foreach ($data['translations'] as $lang => $translation) {
         $tmp = new ArticleTranslation();
         $tmp->assign($translation);
         array_push($articleTranslations, $tmp);
     }
     //Add all categories to the article. No need to create them, we just get the category id from the post data
     if ($data['categories']) {
         $article->categories = Category::find(["id IN (" . $data['categories'] . ")"])->filter(function ($category) {
             return $category;
         });
     }
     if ($data['hashtags']) {
         $article->hashtags = Hashtag::find(["id IN (" . $data['hashtags'] . ")"])->filter(function ($hashtag) {
             return $hashtag;
         });
     }
     $user = User::findFirstById((int) $data['article_user_id']);
     if (!$user) {
         throw new \Exception('User not found', 404);
     }
     $article->setArticleUserId($data['article_user_id']);
     //Add all ArticleTranslations to the Article
     $article->translations = $articleTranslations;
     return $this->save($article, 'create');
 }