public function findId($code, $key = 'Code')
    {
        if ($this->isFillable($key)) {
            $format = ($this->url() == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s';
            if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) {
                $format = "guid'$format'";
            } elseif (is_string($code)) {
                $format = "'$format'";
            }

            $filter = sprintf("$key eq $format", $code);
            $request = [
                '$filter'  => $filter,
                '$top'     => 1,
                '$select'  => $this->primaryKey(),
                '$orderby' => $this->primaryKey(),
            ];
            if ($records = $this->connection()->get($this->url(), $request)) {
                return $records[0][$this->primaryKey()];
            }
        }
    }