protected function importOODocument( $getParams, $getOptions, $postParams, $postOptions, $importType = 'import' )
    {
        $nodeID = $postParams['nodeID'];
        $data = $postParams['data'];
        // Alex 2008/04/22 - Added format argument: 'odt' (default), 'doc'
        $format = $postOptions['format'];
        $languageCode = $postOptions['languageCode'];
        $base64Encoded = $postOptions['base64Encoded'];

        $node = eZContentObjectTreeNode::fetch( $nodeID, $languageCode );

        if ( !$node )
        {
            throw new Exception( 'Could not fetch node: ' . $nodeID );
        }

        // Decode data.
        if ( $base64Encoded )
        {
            // Alex 2008/04/16 - Added str_replace()
            $data = base64_decode( str_replace( ' ', '+', $data ) );
        }

        // Store data to temporary file.
        // Alex 2008/04/22 - Added format argument: 'odt' (default), 'doc'
        $filename = substr( md5( mt_rand() ), 0, 8 ) . ".{$format}";
        $tmpFilePath = eZSys::cacheDirectory() . '/ezodf/' . substr( md5( mt_rand() ), 0, 8 );
        $tmpFilename = $tmpFilePath . '/' . $filename;
        if ( !eZFile::create( $filename, $tmpFilePath, $data ) )
        {
            throw new Exception( 'Could not create file: ' . $tmpFilename );
        }

        $import = new eZOOImport();
        $result = $import->import( $tmpFilename, $nodeID, $filename, $importType );
        eZDir::recursiveDelete( $tmpFilePath );
        if ( !$result )
        {
            throw new Exception( 'OO import failed: ' . $import->getErrorNumber() . ' - ' . $import->getErrorMessage() );
        }

        $domDocument = new DOMDocument( '1.0', 'utf-8' );
        $importElement = $domDocument->createElement( 'OOImport' );

        // Add node info about imported document.
        $importElement->appendChild( $this->createTreeNodeDOMElement( $domDocument, $result['MainNode'] ) );

        return $importElement;
    }