public function executeSaveAppointment()
 {
     $form_id = $this->getParameter('form_id');
     $payment_type = $this->getParameter('payment_type');
     $time_is_available = false;
     if ($form_id) {
         // save appointment only for Local Payment
         $userData = new AB_UserBookingData($form_id);
         $userData->load();
         if (isset($_SESSION['appointment_booking'][$form_id])) {
             $user_data = $_SESSION['appointment_booking'][$form_id];
         } elseif (isset($_SESSION['tmp_booking_data'])) {
             $tmp_booking_data = AB_CommonUtils::getTemporaryBookingData();
             if (!empty($tmp_booking_data)) {
                 // check if appointment's time is still available
                 if (!$this->findIntersections($tmp_booking_data['staff_id'], $tmp_booking_data['service_id'], $tmp_booking_data['booked_datetime'])) {
                     // save appointment to DB
                     $userBookingData = new AB_UserBookingData($form_id);
                     $userBookingData->loadTemporaryForLocalPayment();
                     $userBookingData->save();
                     $time_is_available = true;
                 }
             }
         }
         if (!empty($user_data)) {
             // check if appointment's time is still available
             if (!$this->findIntersections($userData->getStaffid(), $userData->getServiceId(), $userData->getBookedDatetime())) {
                 // save appointment to DB
                 $userBookingData = new AB_UserBookingData($form_id);
                 $userBookingData->load();
                 if (get_option('ab_settings_use_client_time_zone') && $this->getParameter('client_time_zone_offset')) {
                     $userBookingData->setClientTimeOffset($this->getParameter('client_time_zone_offset') / 60 + get_option('gmt_offset'));
                 }
                 $userBookingData->save();
                 $time_is_available = true;
             }
         }
     }
     exit(json_encode(array('state' => $time_is_available)));
 }