public function count($query = [])
    {
        if ($query instanceof Closure) {
            $callback = $query;
            $query = new Query\Where();
            $callback($query);
        }

        if ($query instanceof Query\Where) {
            $query = $query->getWhere();
        }

        if (! is_array($query)) {
            throw new \InvalidArgumentException('The count query should be an array.');
        }

        return $this->collection->count($query);
    }