public function filter($handler)
    {
        $result = array();

        foreach ($this as $id => $document) {
            if (!$handler($document)) {
                continue;
            }

            $result[$id] = $document;
        }

        return $result;
    }