Object response= invokeServerMethod(theMethodParams);
IBundleProvider retVal = toResourceList(response);
if (retVal.size() != resources.size()) {
throw new InternalErrorException("Transaction bundle contained " + resources.size() + " entries, but server method response contained " + retVal.size() + " entries (must be the same)");
}
List<IResource> retResources = retVal.getResources(0, retVal.size());
for (int i =0; i < resources.size(); i++) {
IdDt oldId = oldIds.get(i);
IResource newRes = retResources.get(i);
if (newRes.getId() == null || newRes.getId().isEmpty()) {
throw new InternalErrorException("Transaction method returned resource at index " + i + " with no id specified - IResource#setId(IdDt)");
}
if (oldId != null && !oldId.isEmpty()) {
if (!oldId.getId().equals(newRes.getId())) {
newRes.getResourceMetadata().put(ResourceMetadataKeyEnum.PREVIOUS_ID, oldId.getId());