public static function replace($id, $document, $connection)
    {
        $connection->query = self::singleDocument($document);
        $connection->method = 'PUT';
        $connection->action = '['.urlencode($id).']';
        return self::sendQuery($connection);
    }