def last_sibling_index(parent)
        return -1 if groups.empty?

        if parent.nil?
          parent_index  = 0
          sibling_level = 1
        else
          parent_index  = groups.find_index(parent)
          sibling_level = parent.level + 1
        end

        raise "Could not find group #{parent.name}" if parent_index.nil?

        (parent_index..(header.groups_count - 1)).each do |i|
          break i unless groups[i].level == sibling_level
        end
      end
def last_sibling_index(parent)
        return -1 if groups.empty?

        if parent.nil?
          parent_index  = 0
          sibling_level = 1
        else
          parent_index  = groups.find_index(parent)
          sibling_level = parent.level + 1
        end

        raise "Could not find group #{parent.name}" if parent_index.nil?

        (parent_index..(header.groups_count - 1)).each do |i|
          break i unless groups[i].level == sibling_level
        end
      end
Retrieves last sibling index

  @param parent [Keepassx::Group] Last sibling group.
  @return [Integer] index Group index.