function postProcess()
 {
     //return TRUE;
     $values = $this->controller->exportValues($this->_name);
     // Find the msg_tpl ID of sample invite template
     $teampcpId = CRM_Pcpteams_Utils::getPcpIdByContactAndEvent($this->get('component_page_id'), $this->get('teamContactID'));
     //FIXME : Find the solution to check is empty array of invitees
     $isInviteeEmailFound = FALSE;
     foreach ($values['friend'] as $key => $value) {
         if ($value['email']) {
             $isInviteeEmailFound = TRUE;
         }
     }
     if ($isInviteeEmailFound) {
         // Send Invitation emails
         $pcpDetails = civicrm_api('pcpteams', 'get', array('version' => 3, 'sequential' => 1, 'pcp_id' => $this->get('page_id')));
         list($userName, $userEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_contactID);
         $values['tplParams'] = array('eventName' => $pcpDetails['values'][0]['page_title'], 'userName' => $userName, 'teamName' => $this->get('teamName'), 'pageURL' => CRM_Utils_System::url('civicrm/pcp/support', "reset=1&pageId={$this->get('component_page_id')}&component=event&tpId={$this->_invitedTeamPcpID}", TRUE, NULL, FALSE, TRUE));
         // As team contact id is set in the team join post process, team contact id is not available in this form if you are coming from manage page
         $teamContactId = $this->get('teamContactID');
         if (empty($teamContactId)) {
             $teamContactId = $pcpDetails['values'][0]['contact_id'];
         }
         // Create Team Invite activity
         $actParams = array('assignee_contact_id' => $teamContactId);
         $checkAdminParams = array('version' => 3, 'user_id' => $this->_contactID, 'team_contact_id' => $teamContactId);
         $chkTeamAdmin = civicrm_api('Pcpteams', 'checkTeamAdmin', $checkAdminParams);
         $isTeamAdmin = $chkTeamAdmin['is_team_admin'];
         $teamInviteActivityType = $isTeamAdmin ? CRM_Pcpteams_Constant::C_AT_INVITATION_FROM_ADMIN : CRM_Pcpteams_Constant::C_AT_INVITATION_FROM_MEMBER;
         $activity = CRM_Pcpteams_Utils::createPcpActivity($actParams, $teamInviteActivityType);
         $result = CRM_Pcpteams_Utils::sendInviteEmail(CRM_Pcpteams_Constant::C_MSG_TPL_INVITE_TEAM, $this->_contactID, $values, $teampcpId, $activity['id']);
         if ($result) {
             if ($_GET['snippet']) {
                 // from pcp edit screen
                 CRM_Core_Session::setStatus(ts('Invitation request(s) has been sent'), ts('Invite Team'));
             } else {
                 // from workflow (create team)
                 CRM_Core_Session::setStatus(ts('Your team has been created. We have emailed your team mates asking them to join you. You will receive and email when each of them accepts your invite Invitation request(s) has been sent'), ts('Team Join Request(s) Sent'));
             }
         } else {
             if ($_GET['snippet']) {
                 CRM_Core_Session::setStatus(ts('No invitation request was sent.'), ts('No Invites'));
             } else {
                 // from workflow (create team)
                 CRM_Core_Session::setStatus(ts('Your team has been created. You can invite members from your team page.'), ts('Invite Members From Your Team Page'));
             }
         }
     }
 }