Function restoreGroups

Restores the groups array from imported data, ensuring each item conforms to the DucGroup type.

This function iterates through the raw input, filters out any invalid entries, and constructs a new array of clean, validated DucGroup objects.