public static function instance($result, $client = null)
    {
        if ((array)$result['$data'] === $result['$data']
            && isset($result['$data']['results'])
            && isset($result['$data']['count'])) {
            return new Collection($result, $client);
        }
        
        return new Record($result, $client);
    }