messageElement.appendChild(recipientsElement);
Identifiable[] recipients = message.getRecipients();
for (int r = 0; r < recipients.length; r++) {
if (recipients[r] instanceof User) {
Element userElement = helper.createElement("user");
userElement.setAttribute("id", ((User) recipients[r]).getId());
recipientsElement.appendChild(userElement);
} else if (recipients[r] instanceof Group) {
Element groupElement = helper.createElement("group");
groupElement.setAttribute("id", ((Group) recipients[r]).getId());