def handle(self, *args, **options):
        """
        By convention set by Django developers, this method actually executes command's actions.
        So, there could be no better docstring than emphasize this once again.
        """
        all_option = options.get('all', False)
        replace_option = options.get('replace', False)
        replace_certs = False

        if len(args) == 0 and not all_option:
            raise CommandError(
                u"appsembler_setup_courses requires one or more arguments: <course_id>, or --all"
            )

        store = modulestore()

        if all_option:
            # if reindexing is done during devstack setup step, don't prompt the user
            if query_yes_no(self.CONFIRMATION_PROMPT, default="no"):
                # in case of --all, get the list of course keys from all courses
                # that are stored in the modulestore
                course_keys = []
                try:
                    for course in modulestore().get_courses():
                        course_keys.append(course.id)
                except AttributeError, e:
                    if 'HiddenDescriptor' in e.message:
                        logger.warn('Failed on hidden course without id attr')
                    pass
            else:
                return
                course_keys = []
                try:
                    for course in modulestore().get_courses():
                        course_keys.append(course.id)
                except AttributeError, e:
                    if 'HiddenDescriptor' in e.message:
                        logger.warn('Failed on hidden course without id attr')
                    pass
            else:
                return
        else:
            # in case course keys are provided as arguments
            course_keys = map(self._parse_course_key, args)

        if replace_option:
            if query_yes_no(self.REPLACE_CONFIRMATION_PROMPT, default="no"):
                replace_certs = True
                # set active_default_cert_created to False for courses
                for key in course_keys:
                    course = store.get_course(key)
                    course.active_default_cert_created = False
                    course.save()

        for course_key in course_keys:
            # call functions that are normally signal handlers
            signals._default_mode_on_course_publish(store.__class__,
                                                    course_key)
            signals._change_cert_defaults_on_pre_publish(
                store.__class__, course_key)
            signals.enable_self_generated_certs(store.__class__, course_key)
            signals._make_default_active_certificate(