public function addCondition($field, $value = '', $operator = '==')
    {
        if (!in_array($operator, self::$conditionOperators)) {
            throw new \InvalidArgumentException('Invalid operator');
        }

        // Transform a boolean value to its string representation.
        if (is_bool($value)) {
            $value = $value ? 'true' : 'false';
        }

        // Construct condition statement based on operator.
        if (in_array($operator, ['==', '!='])) {
            $this->conditions[] = $field . $operator . '"' . $value . '"';
        } elseif ($operator === 'guid') {
            $this->conditions[] = $field . '= Guid("'. $value . '")';
        } else {
            $this->conditions[] = $field . '.' . $operator . '("' . $value . '")';
        }

        return $this;
    }