public function moveRecurringRecord($submittedValues)
 {
     // Move recurring record to another contact
     if (!empty($submittedValues['contact_id']) && $submittedValues['contact_id'] != $this->_contactID) {
         $selected_cid = $submittedValues['contact_id'];
         // FIXME: Not getting the below value in $submittedValues
         // So taking the value from $_POST
         if (isset($_POST['membership_record'])) {
             $membership_record = $_POST['membership_record'];
         }
         // Update contact id in civicrm_contribution_recur table
         $recurring = new CRM_Contribute_BAO_ContributionRecur();
         $recurring->id = $this->_id;
         if ($recurring->find(TRUE)) {
             $recurParams = (array) $recurring;
             $recurParams['contact_id'] = $selected_cid;
             CRM_Contribute_BAO_ContributionRecur::create($recurParams);
         }
         // Update contact id in civicrm_contribution table, if 'Move Existing Contributions?' is ticked
         if (isset($submittedValues['move_existing_contributions']) && $submittedValues['move_existing_contributions'] == 1) {
             $contribution = new CRM_Contribute_DAO_Contribution();
             $contribution->contribution_recur_id = $this->_id;
             $contribution->find();
             while ($contribution->fetch()) {
                 $contributionParams = (array) $contribution;
                 $contributionParams['contact_id'] = $selected_cid;
                 // Update contact_id of contributions
                 // related to the recurring contribution
                 CRM_Contribute_BAO_Contribution::create($contributionParams);
             }
         }
     }
     if (!empty($membership_record)) {
         // Remove the contribution_recur_id from existing membership
         if (!empty($this->_membershipID)) {
             $membership = new CRM_Member_DAO_Membership();
             $membership->id = $this->_membershipID;
             if ($membership->find(TRUE)) {
                 $membershipParams = (array) $membership;
                 $membershipParams['contribution_recur_id'] = 'NULL';
                 CRM_Member_BAO_Membership::add($membershipParams);
             }
         }
         // Update contribution_recur_id to the new membership
         $membership = new CRM_Member_DAO_Membership();
         $membership->id = $membership_record;
         if ($membership->find(TRUE)) {
             $membershipParams = (array) $membership;
             $membershipParams['contribution_recur_id'] = $this->_id;
             CRM_Member_BAO_Membership::add($membershipParams);
         }
     }
 }