            foreach ($fields as $field) {
                $fieldName = $field->fieldName;
                if ($field->type == 'date' || $field->type == 'dateTime') {
                    if (is_numeric($record->$fieldName))
                        $record->$fieldName = Formatter::formatLongDateTime($record->$fieldName);
                }elseif ($field->type == 'link') {
                    $name = $record->$fieldName;
                    if (!empty($field->linkType)) {
                        list($name, $id) = Fields::nameAndId($name);
                    }
                    if (!empty($name))
                        $record->$fieldName = $name;
                }elseif ($fieldName == 'visibility') {
                    switch ($record->$fieldName) {
                        case 0:
                            $record->$fieldName = 'Private';
                            break;
                        case 1:
                            $record->$fieldName = 'Public';
                            break;
                        case 2:
                            $record->$fieldName = 'User\'s Groups';
                            break;
                        default:
                            $record->$fieldName = 'Private';
                    }
                }
            }
The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.