public function updateAdvertisementPosition($advertisementPositionID, $changeKey, $advertisementID, $memberID, $positionNumber, $instrumentID, $durationID, $description, $experienceID, $ageRangeID, $genderID, $dbConnection = null)
 {
     $processed = false;
     $update = false;
     try {
         if ($changeKey != null) {
             $position = new AdvertisementPosition();
             $position->setVariable(AdvertisementPosition::ADVERTISEMENT_POSITION_ID, $advertisementPositionID);
             $position->setVariable(AdvertisementPosition::ADVERTISEMENT_ID, $advertisementID);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_NUMBER_CHANGE_KEY, AdvertisementPosition::POSITION_NUMBER, $positionNumber, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_TYPE_CHANGE_KEY, AdvertisementPosition::INSTRUMENT_ID, $instrumentID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_DURATION_CHANGE_KEY, AdvertisementPosition::DURATION_ID, $durationID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_EXP_CHANGE_KEY, AdvertisementPosition::EXPERIENCE_ID, $experienceID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_AGE_CHANGE_KEY, AdvertisementPosition::AGE_RANGE_ID, $ageRangeID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_GENDER_CHANGE_KEY, AdvertisementPosition::GENDER_ID, $genderID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_OTHER_CHANGE_KEY, AdvertisementPosition::DESCRIPTION, $description, $update);
             if ($update) {
                 $processed = AdvertisementPositionDao::updateAdvertisementPosition($memberID, $position, $dbConnection);
             }
         }
     } catch (Exception $ex) {
         $processed = false;
         echo 'Caught exception: ' . $ex->getMessage();
     }
     return $processed;
 }
 if (AdvertisementController::processAdvertisementCreateSecurityCheck($memberID, $inputMemberID, $encryptedID)) {
     $advertisementID = AdvertisementController::createAdvertisement($memberID, $_POST[AdvertisementCreateConstants::FOR_INPUT_ID], $_POST[AdvertisementCreateConstants::SUMMARY_INPUT_ID], $_POST[AdvertisementCreateConstants::DESCRIPTION_INPUT_ID], $_POST[AdvertisementCreateConstants::INSPIRATIONS_INPUT_ID], $_POST[AdvertisementCreateConstants::BAND_INPUT_ID], $_POST[LocationConstants::LOCATION_COUNTRY_INPUT_ID], $_POST[LocationConstants::LOCATION_STATE_INPUT_ID], $_POST[LocationConstants::LOCATION_CITY_INPUT_ID], $_POST[LocationConstants::LOCATION_REGION_INPUT_ID], $dbConnection);
     if ($advertisementID > 0) {
         //If advertisement is for a position in a band.
         if ($_POST[AdvertisementCreateConstants::FOR_INPUT_ID] == 2) {
             $bandID = $_POST[AdvertisementCreateConstants::BAND_INPUT_ID];
             if (BandMemberController::isBandMemberAdmin($bandID, $memberID, $dbConnection)) {
                 BandAdvertisementController::createBandAdvertisement($bandID, $advertisementID, $dbConnection);
             }
         }
         if (AdvertisementGenreController::createAdvertisementGenres($advertisementID, $memberID, $_POST[AdvertisementCreateConstants::GENRE_INPUT_ID], $dbConnection)) {
             $positionCount = $_POST[AdvertisementCreateConstants::POSITION_COUNT_ID];
             echo "Position Count : " . $positionCount;
             $positionList = null;
             for ($i = 1; $i <= $positionCount; $i++) {
                 $position = new AdvertisementPosition();
                 $position->setVariable(AdvertisementPosition::ADVERTISEMENT_ID, $advertisementID);
                 $position->setVariable(AdvertisementPosition::POSITION_NUMBER, $i);
                 $position->setVariable(AdvertisementPosition::INSTRUMENT_ID, $_POST[AdvertisementPositionConstants::POSITION_TYPE_INPUT_ID . $i]);
                 $position->setVariable(AdvertisementPosition::DURATION_ID, $_POST[AdvertisementPositionConstants::POSITION_DURATION_INPUT_ID . $i]);
                 $position->setVariable(AdvertisementPosition::EXPERIENCE_ID, $_POST[AdvertisementPositionConstants::POSITION_EXP_INPUT_ID . $i]);
                 $position->setVariable(AdvertisementPosition::GENDER_ID, $_POST[AdvertisementPositionConstants::POSITION_GENDER_INPUT_ID . $i]);
                 $position->setVariable(AdvertisementPosition::AGE_RANGE_ID, $_POST[AdvertisementPositionConstants::POSITION_AGE_INPUT_ID . $i]);
                 $position->setVariable(AdvertisementPosition::DESCRIPTION, $_POST[AdvertisementPositionConstants::POSITION_OTHER_INPUT_ID . $i]);
                 $positionList[] = $position;
             }
             $processed = AdvertisementPositiionController::createAdvertisementPositions($advertisementID, $memberID, $positionList, $dbConnection);
         }
     }
 } else {
     echo "Security Check Fail \n";
 /**
  * Extracts an Advertisement object from an input PDO query result object.
  *
  * @param PDOItem $result
  * @param boolean $skeleton
  */
 public function extractAdvertisementSearchObject(&$result)
 {
     $advertisement = null;
     try {
         if ($result[AdvertisementSearchDao::ADVERTISEMENT_ID_FIELD] !== null) {
             $genreList = null;
             $positionList = null;
             $advertisement = new Advertisement();
             $advertisement->setVariable(Advertisement::ADVERTISEMENT_ID, $result[AdvertisementSearchDao::ADVERTISEMENT_ID_FIELD]);
             $advertisement->setVariable(Advertisement::ADVERTISEMENT_TYPE_ID, $result[AdvertisementSearchDao::ADVERTISEMENT_TYPE_ID_FIELD]);
             $advertisement->setVariable(Advertisement::SUMMARY, $result[AdvertisementSearchDao::ADVERTISEMENT_SUMMARY_FIELD]);
             $advertisement->setVariable(Advertisement::MEMBER_ID, $result[AdvertisementSearchDao::MEMBER_ID_FIELD]);
             $advertisement->setVariable(Advertisement::MEMBER_FIRST_NAME, $result[AdvertisementSearchDao::MEMBER_FIRST_NAME_FIELD]);
             $advertisement->setVariable(Advertisement::MEMBER_LAST_NAME, $result[AdvertisementSearchDao::MEMBER_LAST_NAME_FIELD]);
             $i = 1;
             for ($i = 1; $i <= AdvertisementSearchDao::POSITION_COUNT; $i++) {
                 $positionID = $result[AdvertisementSearchDao::INSTRUMENT_ID_FIELD . $i];
                 if ($positionID != null) {
                     $position = new AdvertisementPosition();
                     $position->setVariable(AdvertisementPosition::INSTRUMENT_ID, $positionID);
                     $position->setVariable(AdvertisementPosition::INSTRUMENT_NAME, $result[AdvertisementSearchDao::INSTRUMENT_NAME_FIELD . $i]);
                     $positionList[] = $position;
                 }
             }
             $advertisement->setVariable(Advertisement::POSITION_LIST, $positionList);
             $advertisement->setVariable(Advertisement::START_DATE, $result[AdvertisementSearchDao::START_DATE_FIELD]);
             $advertisement->setVariable(LocationConstants::COUNTRY_ID, $result[AdvertisementSearchDao::COUNTRY_ID_FIELD]);
             $advertisement->setVariable(LocationConstants::STATE_ID, $result[AdvertisementSearchDao::STATE_ID_FIELD]);
             $advertisement->setVariable(LocationConstants::CITY_ID, $result[AdvertisementSearchDao::CITY_ID_FIELD]);
             $advertisement->setVariable(LocationConstants::REGION_ID, $result[AdvertisementSearchDao::REGION_ID_FIELD]);
         }
     } catch (PDOException $Exception) {
         echo "extractAdvertisementObject error: " . $Exception->getMessage();
     }
     return $advertisement;
 }
 private function extractAdvertisementPosition(&$result)
 {
     $advertisementPosition = null;
     try {
         if ($result[AdvertisementPositionDao::ADVERTISEMENT_ID_FIELD] != null) {
             $advertisementPosition = new AdvertisementPosition();
             $advertisementPosition->setVariable(AdvertisementPosition::ADVERTISEMENT_POSITION_ID, $result[AdvertisementPositionDao::ADVERTISEMENT_POSITION_ID_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::ADVERTISEMENT_ID, $result[AdvertisementPositionDao::ADVERTISEMENT_ID_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::POSITION_NUMBER, $result[AdvertisementPositionDao::POSITION_NUMBER_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::INSTRUMENT_ID, $result[AdvertisementPositionDao::INSTRUMENT_ID_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::INSTRUMENT_NAME, $result[AdvertisementPositionDao::INSTRUMENT_NAME_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::DURATION_ID, $result[AdvertisementPositionDao::DURATION_ID_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::DESCRIPTION, $result[AdvertisementPositionDao::DESCRIPTION_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::EXPERIENCE_ID, $result[AdvertisementPositionDao::EXPERIENCE_ID_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::GENDER_ID, $result[AdvertisementPositionDao::GENDER_ID_FIELD]);
             $advertisementPosition->setVariable(AdvertisementPosition::AGE_RANGE_ID, $result[AdvertisementPositionDao::AGE_RANGE_ID_FIELD]);
         }
     } catch (Exception $ex) {
         echo 'Caught exception: ' . $ex->getMessage() . "\n";
         $advertisementPosition = null;
     }
     return $advertisementPosition;
 }