def get_details(cls, node, as_model=False):
        """method returns either RestJob instance or corresponding document, depending on the as_model argument """
        rest_job = RestJob(
            process_name=node.process_name,
            timeperiod=node.timeperiod,
            time_qualifier=node.time_qualifier,
            number_of_children=len(node.children),
            number_of_failures='NA' if not node.job_record else node.job_record.number_of_failures,
            state='NA' if not node.job_record else node.job_record.state,
            event_log=[] if not node.job_record else node.job_record.event_log)

        if as_model:
            return rest_job
        else:
            return rest_job.document
method returns either RestJob instance or corresponding document, depending on the as_model argument