code: static void addSequenceNumber(Attribute attr, Iterable<Attribute> attrs) {
      Integer sequenceNumber = attr.getSequenceNumber();
      if (null == sequenceNumber) {
        int i =
            stream(attrs)
                .filter(a -> null != a.getSequenceNumber())
                .mapToInt(Attribute::getSequenceNumber)
                .max()
                .orElse(-1);
        if (i == -1) attr.setSequenceNumber(0);
        else attr.setSequenceNumber(++i);
      }
    }
docs: Add a sequence number to the attribute. If the sequence number exists add it ot the attribute.
  If the sequence number does not exists then find the highest sequence number. If Entity has not
  attributes with sequence numbers put 0.
  
  @param attr the attribute to add
  @param attrs existing attributes