}
ManageablePosition position = _iterator.next();
// Write the related security(ies)
ManageableSecurityLink sLink = position.getSecurityLink();
Security security = sLink.resolveQuiet(getToolContext().getSecuritySource());
if ((security != null) && (security instanceof ManageableSecurity)) {
// Find underlying security
// TODO support multiple underlyings; unfortunately the system does not provide a standard way
// to retrieve underlyings
if (((ManageableSecurity) security).propertyNames().contains("underlyingId")) {
ExternalId id = (ExternalId) ((ManageableSecurity) security).property("underlyingId").get();
Security underlying;
try {
underlying = getToolContext().getSecuritySource().getSingle(id.toBundle());
if (underlying != null) {
return new ObjectsPair<ManageablePosition, ManageableSecurity[]>(
position,