function submit()
 {
     if (!$this->id) {
         return;
     }
     if (!$this->data) {
         return;
     }
     if ($this->status != 'pending') {
         return;
     }
     $api = new WPLA_AmazonAPI($this->account_id);
     // adjust feed encoding
     $feed_content = $this->data;
     if (get_option('wpla_feed_encoding') != 'UTF-8') {
         $feed_content = utf8_decode($feed_content);
     }
     $result = $api->submitFeed($this->FeedType, $feed_content);
     // echo "<pre>";print_r($result);echo"</pre>";die();
     if ($result->success) {
         // update feed status
         $this->FeedSubmissionId = $result->FeedSubmissionId;
         $this->FeedProcessingStatus = $result->FeedProcessingStatus;
         $this->SubmittedDate = $result->SubmittedDate;
         $this->status = 'submitted';
         $this->update();
         // increase feeds in progress
         $feeds_in_progress = get_option('wpla_feeds_in_progress', 0);
         update_option('wpla_feeds_in_progress', $feeds_in_progress + 1);
         // update status of submitted products - except for check feeds
         if (!$this->isCheckFeed()) {
             $lm = new WPLA_ListingsModel();
             // $rows = $this->csv_to_array( $this->data );
             $rows = $this->getDataArray();
             foreach ($rows as $row) {
                 $listing_sku = isset($row['sku']) ? $row['sku'] : $row['item_sku'];
                 $listing_item = $lm->getItemBySKU($listing_sku);
                 if ($listing_item) {
                     // check feed type
                     switch ($this->FeedType) {
                         // Listing Data feed
                         case '_POST_FLAT_FILE_LISTINGS_DATA_':
                             $listing_data = array();
                             $listing_data['status'] = 'submitted';
                             $listing_data['history'] = '';
                             WPLA()->logger->info('changing status to submitted for SKU ' . $listing_sku);
                             // update date_published - only if not set
                             if (!$listing_item->date_published) {
                                 $listing_data['date_published'] = date('Y-m-d H:i:s');
                             }
                             break;
                             // Price And Quantity feed
                         // Price And Quantity feed
                         case '_POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA_':
                             $listing_data = array();
                             $listing_data['pnq_status'] = '2';
                             // submitted
                             WPLA()->logger->info('changing PNQ status to 2 (submitted) for SKU ' . $listing_sku);
                             break;
                             // Inventory Loader (delete) feed
                         // Inventory Loader (delete) feed
                         case '_POST_FLAT_FILE_INVLOADER_DATA_':
                             $listing_data = array();
                             $listing_data['status'] = 'trashed';
                             // submitted for deletion
                             WPLA()->logger->info('changing status to trashed for SKU ' . $listing_sku);
                             break;
                         default:
                             WPLA()->logger->warn('nothing to process for feed type ' . $this->FeedType . ' - SKU ' . $listing_sku);
                             break;
                     }
                     // update database
                     $where_array = array('sku' => $listing_sku, 'account_id' => $this->account_id);
                     $lm->updateWhere($where_array, $listing_data);
                 } else {
                     WPLA()->logger->warn('no listing found for SKU ' . $listing_sku);
                 }
                 // if $listing_item
             }
             // for each row
         }
         // not check feed
     }
     // success
     return $result;
 }