validate(name);
long guestbookId = counterLocalService.increment();
Guestbook guestbook = guestbookPersistence.create(guestbookId);
guestbook.setUuid(serviceContext.getUuid());
guestbook.setUserId(userId);
guestbook.setGroupId(groupId);
guestbook.setCompanyId(user.getCompanyId());
guestbook.setUserName(user.getFullName());
guestbook.setCreateDate(serviceContext.getCreateDate(now));
guestbook.setModifiedDate(serviceContext.getModifiedDate(now));
guestbook.setName(name);
guestbook.setExpandoBridgeAttributes(serviceContext);
guestbookPersistence.update(guestbook);
resourceLocalService.addResources(user.getCompanyId(), groupId, userId,
Guestbook.class.getName(), guestbookId, false, true, true);
AssetEntry assetEntry = assetEntryLocalService.updateEntry(userId,
groupId, guestbook.getCreateDate(),
guestbook.getModifiedDate(), Guestbook.class.getName(),
guestbookId, guestbook.getUuid(), 0,
serviceContext.getAssetCategoryIds(),
serviceContext.getAssetTagNames(), true, null, null, null,
ContentTypes.TEXT_HTML, guestbook.getName(), null, null, null,
null, 0, 0, null, false);
assetLinkLocalService.updateLinks(userId, assetEntry.getEntryId(),
serviceContext.getAssetLinkEntryIds(),
AssetLinkConstants.TYPE_RELATED);