/**
  * Store the subscription data locally (not in billing gateway).
  *
  * @param array $properties
  *
  * @return Subscription
  */
 public function storeLocal(array $properties = array())
 {
     // Cancel in billing gateway, if active.
     if ($this->model->billingIsActive()) {
         $trial_ends_at = $this->model->billing_trial_ends_at;
         $this->subscription->cancel(true);
         $this->refresh();
         $this->model->billing_trial_ends_at = $trial_ends_at;
         $this->model->billing_subscription_ends_at = null;
     }
     $this->model->billing_active = 0;
     $this->model->billing_amount = 0;
     $this->model->billing_interval = null;
     $this->model->billing_card = null;
     $this->model->billing_subscription_discounts = null;
     $this->model->billing_free = (int) $this->is_free;
     if ($this->plan) {
         $this->model->billing_plan = $this->plan;
     }
     if (!empty($properties['quantity'])) {
         $this->model->billing_quantity = $properties['quantity'];
     }
     $this->model->billing_trial_ends_at = $this->skip_trial ? date('Y-m-d H:i:s') : $this->model->billing_trial_ends_at;
     if (!empty($properties['subscription_ends_at'])) {
         $this->model->billing_subscription_ends_at = $properties['subscription_ends_at'];
         $this->model->billing_trial_ends_at = null;
     }
     $this->model->save();
     return $this;
 }