Return nil if groups is empty