code: function() {
  
              var current = this.get('ports') || {};
              var currentItemsMap = {};
  
              util.toArray(current.items).forEach(function(item) {
                  currentItemsMap[item.id] = true;
              });
  
              var previous = this.previous('ports') || {};
              var removed = {};
  
              util.toArray(previous.items).forEach(function(item) {
                  if (!currentItemsMap[item.id]) {
                      removed[item.id] = true;
                  }
              });
  
              var graph = this.graph;
              if (graph && !util.isEmpty(removed)) {
  
                  var inboundLinks = graph.getConnectedLinks(this, { inbound: true });
                  inboundLinks.forEach(function(link) {
  
                      if (removed[link.get('target').port]) link.remove();
                  });
  
                  var outboundLinks = graph.getConnectedLinks(this, { outbound: true });
                  outboundLinks.forEach(function(link) {
  
                      if (removed[link.get('source').port]) link.remove();
                  });
              }
          }
docs: remove links tied wiht just removed element
  @private