public static function storeCustomFieldResults($request, $customFieldGroup, $resource, $objectId, $lang)
    {
        $customFieldGroup   = CustomFieldGroup::find($customFieldGroup);
        $customFields       = CustomField::getRecords(['lang_026' => $lang, 'group_id_026' => $customFieldGroup->id_025]);
        $dataTypes          = collect(config('pulsar.dataTypes'))->keyBy('id');
        $customFieldResults = [];

        foreach($customFields as $customField)
        {
            // if we return an array but the data to be saved is not an array, we will keep as many records containing the array elements
            if(is_array($request->input($customField->name_026 . '_custom')) && $dataTypes[$customField->data_type_id_026]->type != 'array')
            {
                foreach($request->input($customField->name_026 . '_custom') as $value)
                {
                    $customFieldResult = [
                        'object_id_028'         => $objectId,
                        'lang_id_028'           => $lang,
                        'resource_id_028'       => $resource,
                        'field_id_028'          => $customField->id_026,
                        'data_type_type_028'    => $dataTypes[$customField->data_type_id_026]->type,
                        'value_028'             => $value
                    ];

                    $customFieldResults[]  = $customFieldResult;
                }
            }
            elseif($request->input($customField->name_026 . '_custom') !== null)
            {
                $customFieldResult = [
                    'object_id_028'         => $objectId,
                    'lang_id_028'           => $lang,
                    'resource_id_028'       => $resource,
                    'field_id_028'          => $customField->id_026,
                    'data_type_type_028'    => $dataTypes[$customField->data_type_id_026]->type,
                ];

                // if we return an array and the data to be saved is an array, the array will keep like string expression.
                // using insert not access to mutators on Syscover\Pulsar\Models\CustomFieldResult to change the value type of a string to array automatically
                // we have to do manually casting
                if(is_array($request->input($customField->name_026 . '_custom')) && $dataTypes[$customField->data_type_id_026]->type == 'array')
                {
                    $customFieldResult['value_028'] = implode(',', $request->input($customField->name_026 . '_custom'));
                }
                else
                {
                    // get value and record in your field data type, add suffix '_custom' to avoid conflict with other field names
                    if($dataTypes[$customField->data_type_id_026]->type == 'boolean')
                        $customFieldResult['value_028'] = $request->has($customField->name_026 . '_custom');
                    else
                        $customFieldResult['value_028'] = $request->input($customField->name_026 . '_custom');
                }

                $customFieldResults[]  = $customFieldResult;
            }
        }

        if(count($customFieldResults) > 0)
        {
            CustomFieldResult::insert($customFieldResults);
        }
    }