/**
  * @param $postarr
  * @param $lang
  *
  * @return int|WP_Error
  */
 public function icl_insert_post($postarr, $lang)
 {
     $create_post_helper = wpml_get_create_post_helper();
     return $create_post_helper->icl_insert_post($postarr, $lang);
 }
 private function save_duplicate($post_array, $lang)
 {
     if (isset($post_array['ID'])) {
         $id = wp_update_post($post_array);
     } else {
         $create_post_helper = wpml_get_create_post_helper();
         $id = $create_post_helper->icl_insert_post($post_array, $lang);
     }
     return $id;
 }