public int compareTo(LayoutBranch layoutBranch) {
    long primaryKey = layoutBranch.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    LayoutBranch layoutBranch = null;

    try {
      layoutBranch = (LayoutBranch) obj;
    } catch (ClassCastException cce) {
      return false;
    }

    long primaryKey = layoutBranch.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }