public synchronized String[] sendBracketOrders(IOrder parent, IOrder[] children) {
String[] ids = new String[children.length + 1];
int parentInternalId = nextInternalId();
ids[0] = Integer.toString(parentInternalId);
int ocaGroupId = nextOcaGroupId();
OrderBean parentOrderBean = OrderBean.copyOf(parent);
parentOrderBean.setId(Integer.toString(parentInternalId));
currentOrders.add(new OrderInfo(parentOrderBean, parentInternalId, null, null));
for (int i = 0; i < children.length; i++) {
IOrder child = children[i];
OrderBean childOrderBean = OrderBean.copyOf(child);
int childId = nextInternalId();
childOrderBean.setId(Integer.toString(childId));
ids[i + 1] = Integer.toString(childId);
currentOrders.add(new OrderInfo(childOrderBean, childId, ocaGroupId, parentInternalId));
}
processOrders();
return ids;