/**
  * Handle the form when the preview page is submitted
  */
 public static function preview_handler()
 {
     if (!$_POST) {
         return;
     }
     if (version_compare(RESUME_MANAGER_VERSION, '1.11.0', '<')) {
         // Edit = show submit form again
         if (!empty($_POST['edit_resume'])) {
             WP_Resume_Manager_Form_Submit_Resume::previous_step();
         }
         // Continue to the next step
         if (!empty($_POST['continue'])) {
             $resume = get_post(WP_Resume_Manager_Form_Submit_Resume::get_resume_id());
             // Update resume status to pending_payment
             if ($resume->post_status == 'preview') {
                 $update_resume = array();
                 $update_resume['ID'] = $resume->ID;
                 $update_resume['post_status'] = 'pending_payment';
                 wp_update_post($update_resume);
             }
             // If we're already chosen a package, apply its properties to the job here and add to cart
             if ('before' === get_option('resume_manager_paid_listings_flow')) {
                 // Validate Selected Package
                 $validation = self::validate_package(self::$package_id, self::$is_user_package);
                 if (is_wp_error($validation)) {
                     WP_Resume_Manager_Form_Submit_Resume::add_error($validation->get_error_message());
                     WP_Resume_Manager_Form_Submit_Resume::previous_step();
                     WP_Resume_Manager_Form_Submit_Resume::previous_step();
                 }
                 self::process_package(self::$package_id, self::$is_user_package, WP_Resume_Manager_Form_Submit_Resume::get_resume_id());
                 WP_Resume_Manager_Form_Submit_Resume::next_step();
                 // Proceeed to the choose package step if the above did not redirect
             } else {
                 WP_Resume_Manager_Form_Submit_Resume::next_step();
             }
         }
     } else {
         $form = WP_Resume_Manager_Form_Submit_Resume::instance();
         // Edit = show submit form again
         if (!empty($_POST['edit_resume'])) {
             $form->previous_step();
         }
         // Continue to the next step
         if (!empty($_POST['continue'])) {
             $resume = get_post($form->get_resume_id());
             // Update resume status to pending_payment
             if ($resume->post_status == 'preview') {
                 $update_resume = array();
                 $update_resume['ID'] = $resume->ID;
                 $update_resume['post_status'] = 'pending_payment';
                 wp_update_post($update_resume);
             }
             // If we're already chosen a package, apply its properties to the job here and add to cart
             if ('before' === get_option('resume_manager_paid_listings_flow')) {
                 // Validate Selected Package
                 $validation = self::validate_package(self::$package_id, self::$is_user_package);
                 if (is_wp_error($validation)) {
                     $form->add_error($validation->get_error_message());
                     $form->previous_step();
                     $form->previous_step();
                 }
                 self::process_package(self::$package_id, self::$is_user_package, $form->get_resume_id());
                 $form->next_step();
                 // Proceeed to the choose package step if the above did not redirect
             } else {
                 $form->next_step();
             }
         }
     }
 }