private void FillCustomFields(SystemToDbViewModel systemToDbViewModel, JiraRequest jiraRequest, Master master,
                                      Staging staging, MasterHistory masterHistory, List <SyncSystemFieldMapping> fieldMappings,
                                      string epicName)
        {
            List <MasterFieldMappingValue> masterFieldMappingValues =
                masterBusinessService.GetMasterFieldMappingValues(master.MasterId);

            foreach (SyncSystemFieldMapping fieldMapping in fieldMappings)
            {
                string resultValue = "";
                if (fieldMapping.EpmFieldName == ProjectServerConstants.RecordStateGeneral)
                {
                    SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory, RecordStateConst.New, null, true);
                    continue;
                }
                if (fieldMapping.EpmFieldName == ProjectServerConstants.RecordStateActual)
                {
                    SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory,
                                    RecordStateConst.Done, null, true);
                    continue;
                }
                if (String.IsNullOrEmpty(fieldMapping.SystemFieldName))
                {
                    continue;
                }
                if (fieldMapping.EpmFieldName == ProjectServerConstants.EpicName &&
                    !String.IsNullOrEmpty(epicName))
                {
                    SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory, epicName, masterFieldMappingValues);
                    continue;
                }
                CustomField customField = customFields
                                          .FirstOrDefault(x => x.Name == fieldMapping.SystemFieldName);
                if (customField != null)
                {
                    object customFieldValue = jiraRequest.Issue.GetField(customField.Id);
                    if (customFieldValue != null)
                    {
                        if (fieldMapping.IsMultiSelect && customFieldValue is JArray)
                        {
                            //logger.Info($"FillCustomFields JArray: {customFieldValue}");
                            var array = (JArray)customFieldValue;
                            resultValue = array.Aggregate(resultValue, (current, jToken) => current + (jToken + ",")).Trim(',');
                        }
                        else
                        {
                            if (fieldMapping.IsIdWithValue)
                            {
                                //logger.Info($"WebHookReceiver FillCustomFields fieldMapping.SystemFieldName: {fieldMapping.SystemFieldName} customFieldValue.ToString(): {customFieldValue}");
                                var objectProperties = JsonConvert.DeserializeObject <Dictionary <string, object> >(customFieldValue.ToString());

                                if (objectProperties.ContainsKey("value"))
                                {
                                    resultValue = objectProperties["value"].ToString();
                                }
                            }
                            else
                            {
                                resultValue = customFieldValue.ToString();
                            }
                        }
                        if (String.IsNullOrEmpty(resultValue))
                        {
                            continue;
                        }
                        SetCustomFields(systemToDbViewModel, fieldMapping, master, staging, masterHistory, resultValue, masterFieldMappingValues);
                    }
                }
            }
            //await unitOfWork.SaveChangesAsync();
        }