protected void deleteSocialOfficeLayoutSetPrototypes(long companyId) throws Exception {

    LayoutSetPrototype layoutSetPrototype =
        LayoutSetPrototypeUtil.fetchLayoutSetPrototype(
            companyId, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_SITE);

    if (layoutSetPrototype != null) {
      try {
        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(layoutSetPrototype);
      } catch (Exception e) {
        _log.error(e, e);
      }
    }

    layoutSetPrototype =
        LayoutSetPrototypeUtil.fetchLayoutSetPrototype(
            companyId, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PRIVATE);

    if (layoutSetPrototype != null) {
      try {
        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(layoutSetPrototype);
      } catch (Exception e) {
        _log.error(e, e);
      }
    }

    layoutSetPrototype =
        LayoutSetPrototypeUtil.fetchLayoutSetPrototype(
            companyId, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PUBLIC);

    if (layoutSetPrototype != null) {
      try {
        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(layoutSetPrototype);
      } catch (Exception e) {
        _log.error(e, e);
      }
    }

    try {
      ExpandoColumn expandoColumn =
          ExpandoColumnLocalServiceUtil.getColumn(
              companyId,
              LayoutSetPrototype.class.getName(),
              ExpandoTableConstants.DEFAULT_TABLE_NAME,
              SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY);

      ExpandoValueLocalServiceUtil.deleteColumnValues(expandoColumn.getColumnId());
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
  protected void updateUserGroup(Group group) throws Exception {
    LayoutLocalServiceUtil.deleteLayouts(group.getGroupId(), false, new ServiceContext());

    LayoutSetPrototypeUtil.updateLayoutSetPrototype(
        group, false, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PUBLIC);

    LayoutSet publicLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), false);

    PortalClassInvoker.invoke(
        true, _mergeLayoutSetPrototypeLayoutsMethodKey, group, publicLayoutSet);

    LayoutLocalServiceUtil.deleteLayouts(group.getGroupId(), true, new ServiceContext());

    LayoutSetPrototypeUtil.updateLayoutSetPrototype(
        group, true, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PRIVATE);

    LayoutSet privateLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), true);

    PortalClassInvoker.invoke(
        true, _mergeLayoutSetPrototypeLayoutsMethodKey, group, privateLayoutSet);

    SocialOfficeUtil.enableSocialOffice(group);
  }