/**
  * Converts the response in JSON format to the value object i.e Social
  *
  * @param json
  *            - response in JSON format
  *
  * @return Social object filled with json data
  *
  */
 public function buildResponse($json)
 {
     $slJSONObject = $this->getServiceJSONObject("social", $json);
     $sl = new Social();
     $sl->setStrResponse($json);
     $sl->setResponseSuccess($this->isRespponseSuccess($json));
     $this->buildObjectFromJSONTree($sl, $slJSONObject);
     if ($slJSONObject->has("friends")) {
         if ($slJSONObject->__get("friends") instanceof JSONObject) {
             $friendJSONObj = $slJSONObject->__get("friends");
             $friends = new Friends($sl);
             $this->buildJsonFriends($friends, $friendJSONObj);
         } else {
             // There is an Array of attribute
             $friendsJSONArray = $slJSONObject->getJSONArray("friends");
             for ($i = 0; $i < count($friendsJSONArray); $i++) {
                 $friendJSONObj = $friendsJSONArray[$i];
                 $friends = new Friends($sl);
                 $this->buildJsonFriends($friends, $friendJSONObj);
             }
         }
     }
     if ($slJSONObject->has("profile")) {
         if ($slJSONObject->__get("profile") instanceof JSONObject) {
             $publicJSONObject = $slJSONObject->__get("profile");
             $publicfriend = new PublicProfile($sl);
             $this->buildJsonPublicProfile($publicfriend, $publicJSONObject);
         } else {
             // There is an Array of attribute
             $profileJSONArray = $slJSONObject->getJSONArray("profile");
             for ($i = 0; $i < count($profileJSONArray); $i++) {
                 $profileJSONObj = $profileJSONArray[$i];
                 $publicfriends = new PublicProfile($sl);
                 $this->buildJsonPublicProfile($publicfriends, $profileJSONObj);
             }
         }
     }
     if ($slJSONObject->has("me")) {
         if ($slJSONObject->__get("me") instanceof JSONObject) {
             $meJSONObj = $slJSONObject->__get("me");
             $me = new SocialFacebookProfile($sl);
             $this->buildJsonFacebookProfile($me, $meJSONObj);
         }
     }
     if ($slJSONObject->has("facebookProfile")) {
         if ($slJSONObject->__get("facebookProfile") instanceof JSONObject) {
             $meJSONObj = $slJSONObject->__get("facebookProfile");
             $me = new SocialFacebookProfile($sl);
             $this->buildJsonFacebookProfileLink($me, $meJSONObj);
         }
     }
     return $sl;
 }