DataSet ds = getLayer().data;
List<OsmPrimitive> toAdd = new ArrayList<>();
boolean hasNewInOtherLayer = false;
for (PrimitiveData primitive: primitives) {
OsmPrimitive primitiveInDs = ds.getPrimitiveById(primitive);
if (primitiveInDs != null) {
toAdd.add(primitiveInDs);
} else if (!primitive.isNew()) {
OsmPrimitive p = primitive.getType().newInstance(primitive.getUniqueId(), true);
ds.addPrimitive(p);
toAdd.add(p);
} else {
hasNewInOtherLayer = true;
break;