public function postChangeServiceType()
 {
     try {
         // pr(Input::all());
         $user_id = Input::get('user_id');
         $user = Subscriber::findOrFail($user_id);
         $disconnect = new stdClass();
         $disconnect->set = FALSE;
         DB::transaction(function () use($user, $disconnect) {
             $plan_type = Input::get('plan_type');
             if ($user->plan_type != $plan_type) {
                 $disconnect->set = TRUE;
             }
             $user->plan_type = $plan_type;
             if (!$user->save()) {
                 throw new Exception('Failed to change service type.');
             }
             if ($user->plan_type == ADVANCEPAID_PLAN) {
                 $billing = BillingCycle::firstOrNew(['user_id' => $user->id]);
                 $input = Input::all();
                 $input['expiration'] = date("Y-m-d H:i:s", strtotime($input['expiration']));
                 $billing->fill($input);
                 if (!$billing->save()) {
                     throw new Exception("Failed to save billing cycle details.");
                 }
                 // pr($billing->toArray());
             }
             if ($user->plan_type == FREE_PLAN) {
                 Subscriber::updateFreePlan($user->id);
             }
         });
         if ($disconnect->set) {
             Subscriber::destroyAllSessions($user);
         }
         $this->notifySuccess("Service Type Updated.");
     } catch (Exception $e) {
         $this->notifyError($e->getMessage());
         return Redirect::route('subscriber.profile', $user_id);
     }
     return Redirect::route('subscriber.profile', $user_id);
 }