public static function restore(array $data)
    {
        if (!isset($data['invocable'], $data['params'])){
            return null;
        }
        /**
         * @var $task Task
         */
        $class = self::class;
        $task = new $class();
        if (isset($data['report'])) {
            $task->setReport($data['report']);
        }
        if (isset($data['status'])) {
            $task->setStatus($data['status']);
        }
        if (isset($data['id'])) {
            $task->setId($data['id']);
        }
        if (isset($data['added'])) {
            $task->setCreationDate($data['added']);
        }
        if (isset($data['owner'])) {
            $task->setOwner($data['owner']);
        }
        if (isset($data['label'])) {
            $task->setLabel($data['label']);
        }
        if (isset($data['type'])) {
            $task->setType($data['type']);
        }
        if (isset($data['added'])) {
            $task->setType($data['added']);
        }
        if(isset($data['invocable'])) {
            $task->setInvocable($data['invocable']);
        }
        if (isset($data['params'])) {
            $task->setParameters($data['params']);
        }
        return $task;
    }