if (resource == null) throw new IllegalStateException("could not determine unique resource");
from = new EntityImpl(sessionContext.getInitiatingEntity(), resource);
StanzaBuilder stanzaBuilder = new StanzaBuilder(stanza.getName());
for (Attribute attribute : stanza.getAttributes()) {
if ("from".equals(attribute.getName())) continue;
stanzaBuilder.addAttribute(attribute);
}
stanzaBuilder.addAttribute("from", from.getFullQualifiedName());
for (XMLElement preparedElement : stanza.getInnerElements()) {
stanzaBuilder.addPreparedElement(preparedElement);
}