private UPMStandardGroup CreateNewGroupRecordAsNew(Dictionary <string, object> parentInitialValues, UPCRMRecord record, bool asNew)
        {
            UPContainerMetaInfo metaInfo = new UPContainerMetaInfo(this.ChildFieldControl);
            UPCRMResult         result   = !string.IsNullOrEmpty(record?.RecordId) ? metaInfo.NewRecordWithRecordId(record.RecordId) : metaInfo.NewRecord();

            UPCRMResultRow     childRow         = (UPCRMResultRow)result.ResultRowAtIndex(0);
            UPChildEditContext childEditContext = new UPChildEditContext(childRow, this.NextPostfix);

            if (asNew)
            {
                childEditContext.SetAsNew();
            }

            if (record != null)
            {
                childEditContext.AddChangedLinksFromRecordParentLink(record, null);
            }

            FieldControlTab childFieldControlTab = this.ChildFieldControl.TabAtIndex(0);

            this.combinedInitialValues = null;
            if (this.initialValues != null)
            {
                if (parentInitialValues != null)
                {
                    Dictionary <string, object> combined = new Dictionary <string, object>(this.initialValues);
                    foreach (var item in parentInitialValues)
                    {
                        combined[item.Key] = item.Value;
                    }

                    this.combinedInitialValues = combined;
                }
                else
                {
                    this.combinedInitialValues = this.initialValues;
                }
            }
            else
            {
                this.combinedInitialValues = parentInitialValues;
            }

            List <UPCRMRecord> initialRecords = record != null ? new List <UPCRMRecord> {
                record
            } : null;

            List <object> editFieldContextArray = this.EditContextsFor(childRow, childFieldControlTab,
                                                                       childEditContext.EditFieldContext, this.combinedInitialValues, initialRecords);
            int editFieldCount = editFieldContextArray.Count;

            if (editFieldCount > 0)
            {
                UPMStandardGroup group = new UPMStandardGroup(new RecordIdentifier(childRow.RootRecordIdentification));
                group.Deletable        = true;
                childEditContext.Group = group;
                this.AddChildRecordContext(childEditContext);
                for (int j = 0; j < editFieldCount; j++)
                {
                    UPEditFieldContext editFieldContext = editFieldContextArray[j] as UPEditFieldContext;
                    if (editFieldContext != null)
                    {
                        editFieldContext.ChildEditContext  = childEditContext;
                        editFieldContext.FieldLabelPostfix = childEditContext.FieldLabelPostfix;
                        List <UPMEditField> editFields = editFieldContext.EditFields;
                        if (editFields.Count > 0)
                        {
                            foreach (UPMEditField editField in editFields)
                            {
                                editField.EditFieldsContext = childEditContext;
                                group.AddField(editField);
                            }
                        }
                        else
                        {
                            UPMField field = editFieldContext.Field;
                            if (field != null)
                            {
                                group.AddField(field);
                            }
                        }
                    }
                    else
                    {
                        group.AddField((UPMField)editFieldContextArray[j]);
                    }
                }

                childEditContext.HandleDependentFields();
                return(group);
            }

            return(null);
        }