protected function resultToModels($result)
    {
        $models = array();
        foreach ($result as $r) {
            $pk = $r->{$this->pk};

            try {
                // It is inefficient to fetch every record from the DB here
                // Instead, pass in the result data
                $models[] = new $this->class($pk, $r);
            } catch (\Exception $e) {
            }
        }
        return $models;
    }