public SocialActivitySet addActivitySet(long activityId) throws PortalException, SystemException {

    // Activity set

    SocialActivity activity = socialActivityPersistence.findByPrimaryKey(activityId);

    long activitySetId = counterLocalService.increment();

    SocialActivitySet activitySet = socialActivitySetPersistence.create(activitySetId);

    activitySet.setGroupId(activity.getGroupId());
    activitySet.setCompanyId(activity.getCompanyId());
    activitySet.setUserId(activity.getUserId());
    activitySet.setCreateDate(activity.getCreateDate());
    activitySet.setModifiedDate(activity.getCreateDate());
    activitySet.setClassName(activity.getClassName());
    activitySet.setClassPK(activity.getClassPK());
    activitySet.setType(activity.getType());
    activitySet.setActivityCount(1);

    socialActivitySetPersistence.update(activitySet);

    // Activity

    activity.setActivitySetId(activitySetId);

    socialActivityPersistence.update(activity);

    return activitySet;
  }
  public void incrementActivityCount(long activitySetId, long activityId)
      throws PortalException, SystemException {

    // Activity set

    SocialActivitySet activitySet = socialActivitySetPersistence.findByPrimaryKey(activitySetId);

    SocialActivity activity = socialActivityPersistence.findByPrimaryKey(activityId);

    activitySet.setModifiedDate(activity.getCreateDate());

    activitySet.setActivityCount(activitySet.getActivityCount() + 1);

    socialActivitySetPersistence.update(activitySet);

    // Activity

    activity.setActivitySetId(activitySetId);

    socialActivityPersistence.update(activity);
  }
  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static SocialActivity toModel(SocialActivitySoap soapModel) {
    if (soapModel == null) {
      return null;
    }

    SocialActivity model = new SocialActivityImpl();

    model.setActivityId(soapModel.getActivityId());
    model.setGroupId(soapModel.getGroupId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setUserId(soapModel.getUserId());
    model.setCreateDate(soapModel.getCreateDate());
    model.setActivitySetId(soapModel.getActivitySetId());
    model.setMirrorActivityId(soapModel.getMirrorActivityId());
    model.setClassNameId(soapModel.getClassNameId());
    model.setClassPK(soapModel.getClassPK());
    model.setParentClassNameId(soapModel.getParentClassNameId());
    model.setParentClassPK(soapModel.getParentClassPK());
    model.setType(soapModel.getType());
    model.setExtraData(soapModel.getExtraData());
    model.setReceiverUserId(soapModel.getReceiverUserId());

    return model;
  }