static function createWorkflow($workflow_config) {
        self::validateConfig($workflow_config);
        self::validateState($workflow_config[self::CONF_HANDLER], $workflow_config[self::CONF_INITIAL_STATE]);

        if (!isset($workflow_config["name"])) {
            $workflow_config["name"] = $workflow_config[self::CONF_HANDLER] . '(' . implode(",", $workflow_config[self::CONF_PARAMS]) . ")";
        }
        if (!isset($workflow_config["active"])) {
            $workflow_config["active"] = true;
        }
        /**
         * defines the maximum age before a job is considered old.
         * 23 hours are default.
         */
        if (!isset($workflow_config["max_age"])) {
            $workflow_config["max_age"] = Moment::ONEDAY - Moment::ONEHOUR;
        }
        /**
         * Setting some defaults
         */
        $workflow_config["application"] = Util::getApplicationId();
        $workflow_config["service"] = Util::getModuleId();
        $workflow_config["created"] = new \DateTime();
        $workflow_key = self::createWorkflowKeyFromConfig($workflow_config);
        DataStore::saveWorkflow($workflow_key, $workflow_config);
        return $workflow_config;
    }