def setActivities(self, *args, **kwargs):
        """Adds the activities for this group to a 'activities' field.

        Activities are MambuActivity objects.

        Activities get sorted by activity timestamp.

        Returns the number of requests done to Mambu.
        """
        def activityDate(activity):
            """Util function used for sorting activities according to timestamp"""
            try:
                return activity['activity']['timestamp']
            except KeyError as kerr:
                return None
        try:
            activities = self.mambuactivitiesclass(groupId=self['encodedKey'], *args, **kwargs)
        except AttributeError as ae:
            from .mambuactivity import MambuActivities
            self.mambuactivitiesclass = MambuActivities
            activities = self.mambuactivitiesclass(groupId=self['encodedKey'], *args, **kwargs)

        activities.attrs = sorted(activities.attrs, key=activityDate)
        self['activities'] = activities

        return 1
Adds the activities for this group to a 'activities' field.

        Activities are MambuActivity objects.

        Activities get sorted by activity timestamp.

        Returns the number of requests done to Mambu.