public static function groupArrayOfObjectsByMember($member, $objects) {

        if (!is_array($member))
            $member = array($member);

        $leafMember = array_pop($member);


        $groupedObjects = new AssociativeArray();

        foreach ($objects as $object) {

            $rootNode = $groupedObjects;
            foreach ($member as $memberComponent) {
                $groupValue = $object->__getSerialisablePropertyValue($memberComponent);
                if (!$groupValue && !is_numeric($groupValue)) $groupValue = "NULL";

                if (!isset($rootNode[$groupValue]))
                    $rootNode[$groupValue] = new AssociativeArray();

                $rootNode = $rootNode[$groupValue];
            }

            $leafValue = $object->__getSerialisablePropertyValue($leafMember);
            if (!$leafValue && !is_numeric($leafValue)) $leafValue = "NULL";

            if (!$rootNode[$leafValue])
                $rootNode[$leafValue] = array();

            $leafValues = $rootNode[$leafValue];
            $leafValues[] = $object;
            $rootNode[$leafValue] = $leafValues;
        }

        return $groupedObjects->toArray();
    }