private function valueExists($query, $value)
    {
        if (is_array($value)) {
            return $query->count("DISTINCT [[$this->targetAttribute]]")
                ->then(function($count) use ($value) {
                    return $count == count($value) ? true : reject(new Error("Not exists (count mismatch)"));
                });
        }
        return $query->exists();
    }