private string GetAttributeMessage(QueueItemModel item, out IIndexModel indexModel, out IndexItemModel itemModel) { var attributeModel = attributeRepository.GetById(item.TargetEntityId.ToString()); var entityModel = entityRepository.GetById(attributeModel.EntityId.ToString()); var entityOptions = entityRepository.LoadOptions(entityModel.Id.ToString(), new List <string> { "Indexer" }); var attributeOptions = attributeRepository.LoadOptions(attributeModel.Id.ToString(), new List <string> { "Indexer" }); var attributeItemModel = attributeRepository.GetIndexedItemById(attributeModel, item.TargetItemId); var entityItemModel = entityRepository.GetIndexedItemBySourceId(entityModel, attributeItemModel.GetSourceId()); itemModel = attributeItemModel; var entityReporterMappingOption = entityOptions.FirstOrDefault(o => o.Key == "indexer_reporter_columns"); var entityReporterMappingColumns = !string.IsNullOrWhiteSpace(entityReporterMappingOption?.Value) ? JsonConvert.DeserializeObject <List <ReporterColumnMapping> >(entityReporterMappingOption.Value) : new List <ReporterColumnMapping> { new ReporterColumnMapping { SourceName = "Value", MappingName = "Name", Key = true, Value = true } }; var attributeReporterMappingOption = attributeOptions.FirstOrDefault(o => o.Key == "indexer_reporter_columns"); var attributeReporterMappingColumns = !string.IsNullOrWhiteSpace(attributeReporterMappingOption?.Value) ? JsonConvert.DeserializeObject <List <ReporterColumnMapping> >(attributeReporterMappingOption.Value) : new List <ReporterColumnMapping> { new ReporterColumnMapping { SourceName = "Value", MappingName = "Name", Key = true, Value = true } }; var keys = entityReporterMappingColumns.Where(r => r.Key) .Select(r => $@"_{r.MappingName}_: {entityItemModel.GetValue(r.SourceName)?.ToString() ?? "(empty)"}"); var vals = attributeReporterMappingColumns.Where(r => r.Value) .Select(r => $@"_{r.MappingName}_: {attributeItemModel.GetValue(r.SourceName)?.ToString() ?? "(empty)"}"); if (attributeReporterMappingColumns.Count == 1) { vals = attributeReporterMappingColumns.Where(r => r.Value) .Select(r => $@"{attributeItemModel.GetValue(r.SourceName)?.ToString() ?? "(empty)"}"); } var executed = item.ExecutedAt.UnixTimeToTime().ToString("G"); var executedIn = item.ExecutedAt - item.ExecuteAt; indexModel = attributeModel; return($@"*{indexModel.Name}* ({string.Join(", ", keys)}): {vals} {executed} in {executedIn} second(s)"); }