private static PropertyInfo GetPropertyInfo(object container, int attributeId) { return container.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(propertyInfo => propertyInfo.GetCustomAttributes(false).ToDictionary(a => a.GetType().Name, a => a).Any(element => ((ColumnIndex) element.Value).Id == attributeId)).Select(propertyInfo => container.GetType().GetProperty(propertyInfo.Name)).FirstOrDefault(); }