public static JSONObject toJSONObject(AssetTag model) {
    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

    jsonObject.put("tagId", model.getTagId());
    jsonObject.put("groupId", model.getGroupId());
    jsonObject.put("companyId", model.getCompanyId());
    jsonObject.put("userId", model.getUserId());
    jsonObject.put("userName", model.getUserName());

    Date createDate = model.getCreateDate();

    String createDateJSON = StringPool.BLANK;

    if (createDate != null) {
      createDateJSON = String.valueOf(createDate.getTime());
    }

    jsonObject.put("createDate", createDateJSON);

    Date modifiedDate = model.getModifiedDate();

    String modifiedDateJSON = StringPool.BLANK;

    if (modifiedDate != null) {
      modifiedDateJSON = String.valueOf(modifiedDate.getTime());
    }

    jsonObject.put("modifiedDate", modifiedDateJSON);
    jsonObject.put("name", model.getName());
    jsonObject.put("assetCount", model.getAssetCount());

    return jsonObject;
  }
  protected ServiceContext createServiceContext(
      PortletDataContext portletDataContext, AssetTag assetTag) {

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);
    serviceContext.setCreateDate(assetTag.getCreateDate());
    serviceContext.setModifiedDate(assetTag.getModifiedDate());
    serviceContext.setScopeGroupId(portletDataContext.getScopeGroupId());

    return serviceContext;
  }