public static function factory (array $record)
    {
        if (!array_key_exists('fields', $record)) {
            throw new InvalidArgumentException("Missing 'fields' index in record array");
        }
        $fields = array_map(array('HAB\Pica\Record\Field', 'factory'), $record['fields']);
        $type = null;
        $typePredicate = Field::match('002@/00');
        foreach ($fields as $field) {
            if ($typePredicate($field)) {
                $typeSubfield = $field->getNthSubfield('0', 0);
                if ($typeSubfield) {
                    $type = $typeSubfield->getValue();
                    break;
                }
            }
        }
        if ($type === null) {
            throw new InvalidArgumentException("Missing type field (002@/00$0)");
        }
        if ($type[0] === 'T') {
            return new AuthorityRecord($fields);
        } else {
            return new TitleRecord($fields);
        }
    }