protected function verifyRequiredFields(SelectQuery $query, array $requiredFields = null) {
        if ($requiredFields == null) {
            $requiredFields = $this->getRequiredFields();
        }
        if (!empty($requiredFields)) {
            foreach ($requiredFields as $requiredField) {
                if (empty($query->getWhereCondition($requiredField, null, false, true))) {
                    throw new RuntimeException("Condition required: $requiredField");
                }
            }
        }
    }