public function deleteByRoot( $rootId = null, array $except = array() )
    {
        if ( null === $rootId )
        {
            $where = array( new Predicate\IsNull(
                'rootParagraphId'
            ) );
        }
        else
        {
            $where = array(
                'rootParagraphId' => (int) $rootId,
            );
        }

        if ( ! empty( $except ) )
        {
            $where[] = new Predicate\NotIn( 'id', $except );
        }

        $delete = $this->sql()
                       ->delete()
                       ->where( $where );

        $result = $this->sql()
                       ->prepareStatementForSqlObject( $delete )
                       ->execute();

        return $result->getAffectedRows();
    }