private void ProcessMetaData(string xmlFileNamePath, FieldInfo[] fieldsToProcess, TypeMetadata typeMetadata,
                                     Type metadataType, object obj)
        {
            foreach (var field in fieldsToProcess)
            {
                var fieldName = field.Name;
                if (!typeMetadata.FieldGroups.Any(fg => fg.FieldName.Equals(fieldName)))
                {
                    typeMetadata.FieldGroups.Add(new FieldGroup(fieldName));
                }

                var thisFieldGroup = typeMetadata.FieldGroups.First(fg => fg.FieldName.Equals(fieldName));


                if (extraMetadataExtractFields.ContainsKey(fieldName))
                {
                    foreach (var extractField in extraMetadataExtractFields[fieldName])
                    {
                        FieldGroup newFieldGroup;
                        if (!typeMetadata.FieldGroups.Any(fg => fg.FieldName.Equals(extractField.ExtractedFieldName)))
                        {
                            newFieldGroup = new FieldGroup(extractField.ExtractedFieldName);
                            typeMetadata.FieldGroups.Add(newFieldGroup);
                        }
                        else
                        {
                            newFieldGroup =
                                typeMetadata.FieldGroups.First(fg =>
                                                               fg.FieldName.Equals(extractField.ExtractedFieldName));
                        }

                        var value = GetValueBasedOnType(metadataType, field, obj);

                        extractField.ValueExtracted = ExtractValue(extractField.ExtractionRegex, value);

                        InsertFieldValueWithBackfill(xmlFileNamePath, newFieldGroup, typeMetadata,
                                                     extractField.ValueExtracted);
                        DetermineIfMismatchExists(typeMetadata, newFieldGroup);
                    }

                    InsertFieldValueWithBackfill(xmlFileNamePath, thisFieldGroup, typeMetadata, MetadataNotAvailable);
                    DetermineIfMismatchExists(typeMetadata, thisFieldGroup);
                }
                else
                {
                    var thisValue = GetValueBasedOnType(metadataType, field, obj);
                    InsertFieldValueWithBackfill(xmlFileNamePath, thisFieldGroup, typeMetadata, thisValue);
                    DetermineIfMismatchExists(typeMetadata, thisFieldGroup);
                }
            }

            foreach (var fieldGroup in typeMetadata.FieldGroups.Where(fg =>
                                                                      fg.Values.Length < typeMetadata.ValidResultCount + 1))
            {
                while (fieldGroup.Values.Length < typeMetadata.ValidResultCount + 1)
                {
                    InsertFieldValue(xmlFileNamePath, fieldGroup, MetadataNotAvailable, isMismatched: true);
                }
            }

            typeMetadata.ValidResultCount++;
        }