@staticmethod
def register_service_into_servicegroups(service, servicegroups):
    """
        Registers a service into the service groups declared in its
        `servicegroups` attribute.

        :param service: The service to register
        :type service:
        :param servicegroups: The servicegroups container
        :type servicegroups:
        :return: None
        """
    if hasattr(service, 'service_description'):
        sname = service.service_description
        shname = getattr(service, 'host_name', '')
        if hasattr(service, 'servicegroups'):
            if isinstance(service.servicegroups, list):
                sgs = service.servicegroups
            else:
                sgs = service.servicegroups.split(',')
            for servicegroup in sgs:
                servicegroups.add_member([shname, sname], servicegroup.strip())
