private PropertyInfo GetPropertyInfo(SPListItem item, Type entityType, FieldToEntityPropertyMapping fieldMapping)
        {
            PropertyInfo propertyInfo = entityType.GetProperty(fieldMapping.EntityPropertyName);

            if (propertyInfo == null)
            {
                string errorMessage = string.Format(CultureInfo.CurrentCulture, "Type '{0}' does not have a property '{1}' which was mapped to FieldID: '{2}' for SPListItem '{3}'."
                                                    , entityType.FullName
                                                    , fieldMapping.EntityPropertyName
                                                    , fieldMapping.ListFieldId
                                                    , item.Name);
                throw new ListItemFieldMappingException(errorMessage);
            }
            return(propertyInfo);
        }
        private void EnsureListFieldID(SPListItem item, Type entityType, FieldToEntityPropertyMapping fieldMapping)
        {
            try
            {
                var ensuredField = item.Fields[fieldMapping.ListFieldId];
            }
            catch (ArgumentException argumentException)
            {
                string errorMessage = string.Format(CultureInfo.CurrentCulture
                                                    , "SPListItem '{0}' does not have a field with Id '{1}' which was mapped to property: '{2}' for entity '{3}'."
                                                    , item.Name
                                                    , fieldMapping.ListFieldId
                                                    , fieldMapping.EntityPropertyName
                                                    , entityType.FullName);

                throw new ListItemFieldMappingException(errorMessage, argumentException);
            }
        }