def addReferenceAnalyses(self, reference, services, slot=None):
        """ Creates and add reference analyses to the slot by using the
        reference sample and service uids passed in.
        If no destination slot is defined, the most suitable slot will be used,
        typically a new slot at the end of the worksheet will be added.
        :param reference: reference sample to which ref analyses belong
        :param service_uids: he uid of the services to create analyses from
        :param slot: slot where reference analyses must be stored
        :return: the list of reference analyses added
        """
        service_uids = list()
        for service in services:
            if api.is_uid(service):
                service_uids.append(service)
            else:
                service_uids.append(api.get_uid(service))
        service_uids = list(set(service_uids))

        # Cannot add a reference analysis if not open
        if api.get_workflow_status_of(self) != "open":
            return []

        slot_to = to_int(slot)
        if slot_to < 0:
            return []

        if not slot_to:
            # Find the suitable slot to add these references
            slot_to = self.get_suitable_slot_for_reference(reference)
            return self.addReferenceAnalyses(reference, service_uids, slot_to)

        processed = list()
        for analysis in self.get_analyses_at(slot_to):
            if api.get_review_status(analysis) != "retracted":
                service = analysis.getAnalysisService()
                processed.append(api.get_uid(service))
        query = dict(portal_type="AnalysisService", UID=service_uids,
                     sort_on="sortable_title")
        services = filter(lambda service: api.get_uid(service) not in processed,
                          api.search(query, "bika_setup_catalog"))

        # Ref analyses from the same slot must have the same group id
        ref_gid = self.nextRefAnalysesGroupID(reference)
        ref_analyses = list()
        for service in services:
            service_obj = api.get_object(service)
            ref_analysis = self.add_reference_analysis(reference, service_obj,
                                                        slot_to, ref_gid)
            if not ref_analysis:
                continue
            ref_analyses.append(ref_analysis)
        return ref_analyses
Creates and add reference analyses to the slot by using the
        reference sample and service uids passed in.
        If no destination slot is defined, the most suitable slot will be used,
        typically a new slot at the end of the worksheet will be added.
        :param reference: reference sample to which ref analyses belong
        :param service_uids: he uid of the services to create analyses from
        :param slot: slot where reference analyses must be stored
        :return: the list of reference analyses added