public static function unsubscribe(string $hook, int $hook_reference)
    {
        $parts = explode(".", $hook);
        if (count($parts) < 2)
            throw new InvalidArgumentException("Hook name must consist of at least two parts");

        if (!isset(self::$hooks[$hook]))
            throw new InvalidArgumentException("Hook was not set");

        foreach (self::$hooks[$hook] as $idx => $hook_data)
        {
            if ($hook_data['ref'] === $hook_reference)
            {
                unset(self::$hooks[$hook][$idx]);
                return true;
            }
        }
        return false;
    }