public CrmEntityMetadata GetEntityMetaData(string logicalName)
        {
            var key = $"MetaDataHelper.GetEntityMetaData|{logicalName}";
            var cachedEntityMetaData = GetFromMemCache <CrmEntityMetadata>(key);

            if (cachedEntityMetaData != null)
            {
                return(cachedEntityMetaData);
            }

            var retrievedMetaData = MetadataHelpers.GetEntity(service, logicalName, CrmService.OrgId);

            return(AddToMemCache(key,
                                 new CrmEntityMetadata
            {
                LogicalName = retrievedMetaData.LogicalName,
                DisplayName = retrievedMetaData.DisplayName?.UserLocalizedLabel?.Label,
                IdFieldName = retrievedMetaData.PrimaryIdAttribute,
                AlternateKeyNames = retrievedMetaData.Keys.SelectMany(k => k.KeyAttributes).ToList(),
                FieldsMetaData = retrievedMetaData.Attributes
                                 .Where(a => a.DisplayName?.UserLocalizedLabel?.Label != null)
                                 .Select(a => new FieldMetadata
                {
                    LogicalName = a.LogicalName,
                    DisplayName = a.DisplayName.UserLocalizedLabel.Label,
                    Type = a.AttributeType
                }).ToList(),
                RelationsMetaData = MetadataHelpers.BuildRelationMetadata(retrievedMetaData).ToList()
            }));
        }