@Override
  @Transactional
  public Collection create(CollectionDetailsInfo collectionDetailsInfo, UserAccount user)
      throws Exception {

    String filteredTrack = collectionDetailsInfo.getTrack();

    if (!StringUtils.isEmpty(filteredTrack)) {
      filteredTrack = getFilteredTrack(filteredTrack);

      if (StringUtils.isEmpty(filteredTrack)) {
        return null;
      }
    }

    Collection collection = adaptCollectionDetailsInfoToCollection(collectionDetailsInfo, user);
    collection.setTrack(filteredTrack);
    collection.setUsageType(UsageType.Production);
    try {
      collectionRepository.save(collection);
      collaboratorService.addCollaboratorToCollection(
          collectionDetailsInfo.getCode(), user.getId());
      return collection;
    } catch (Exception e) {

      logger.error("Error in creating collection.", e);
      return null;
    }
  }
  @Override
  public JSONArray searchFacebookProfiles(
      String keyword, Integer offset, Integer limit, UserAccount userEntity) {
    UserConnection userConnection =
        userConnectionService.fetchByCombinedUserName(userEntity.getUserName());
    userConnection.getAccessToken();
    try {
      Client client = ClientBuilder.newBuilder().register(JacksonFeature.class).build();
      WebTarget webResource =
          client.target(
              fetchMainUrl
                  + "/"
                  + SocialSignInProvider.FACEBOOK
                  + "/searchProfiles"
                  + "?offset="
                  + offset
                  + "&limit="
                  + limit
                  + "&keyword="
                  + URLEncoder.encode(keyword, "UTF-8"));

      ObjectMapper objectMapper = JacksonWrapper.getObjectMapper();

      Response clientResponse =
          webResource
              .request(MediaType.APPLICATION_JSON)
              .post(Entity.json(userConnection.getAccessToken()), Response.class);

      String jsonString = clientResponse.readEntity(String.class);
      JSONParser parser = new JSONParser();
      JSONObject jsonResponse = (JSONObject) parser.parse(jsonString);
      JSONArray response =
          objectMapper.readValue(jsonResponse.get("entity").toString(), JSONArray.class);
      return response;
    } catch (Exception e) {
      logger.error("Exception while searching facebok profiles", e);
    }
    return null;
  }