/**
  * updateSubscriptions
  * --------------------------------------------------
  * Updating the BraintreeSubscriptions.
  * @return The stripe plans.
  * @throws BraintreeNotConnected
  * --------------------------------------------------
  */
 public function updateSubscriptions()
 {
     // Updating plans to be up to date.
     $this->updatePlans();
     $subscriptions = array();
     // Clollecting subscriptions.
     try {
         $braintreeSubscriptions = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::status()->in(array(Braintree_Subscription::ACTIVE))));
     } catch (Exception $e) {
         // Something went wrong.
         return;
     }
     foreach ($braintreeSubscriptions as $subscription) {
         $new_subscription = new BraintreeSubscription(array('start' => $subscription->firstBillingDate, 'status' => $subscription->status));
         $plan = BraintreePlan::where('plan_id', $subscription->planId)->first();
         if ($plan === null) {
             // Braintree integrity error, link to a non-existing plan.
             return array();
         }
         $new_subscription->plan()->associate($plan);
         array_push($subscriptions, $new_subscription);
     }
     // Save new.
     foreach ($subscriptions as $subscription) {
         $subscription->save();
     }
     return $subscriptions;
 }