@Override
    public boolean equals(Object obj) {
        if (obj instanceof AbstractEntity) {
            return (getId() == null) ? super.equals(obj) : getId().equals(((AbstractEntity) obj).getId());
        }
        return super.equals(obj);
    }