private static string GetLookupCamlQuery(FieldMappingDefinition definition, object value)
        {
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }

            var sw = new StringWriter();

            sw.Write("<View><Query><Where>");
            sw.WriteLine("<{0}><FieldRef Name=\"{1}\" /><Value Type=\"{2}\">{3}</Value></{0}>", CalmQueryItemType.Equal.GetCalmTag(), definition.LookupFieldKey, (value is string) ? "Text" : "Number", value);
            sw.Write("</Where></Query></View>");

            return(sw.ToString());
        }
        internal static Dictionary <string, FieldMappingDefinition> GetFieldsMappings(object fieldsMapping)
        {
            var mapType  = fieldsMapping.GetType();
            var mapProps = mapType.GetProperties();
            var fieldMappingDefinitionType = typeof(FieldMappingDefinition);

            return(mapProps.ToDictionary(prop => prop.Name, prop =>
            {
                if (prop.PropertyType == fieldMappingDefinitionType)
                {
                    var definition = prop.GetValue(fieldsMapping) as FieldMappingDefinition;
                    return definition;
                }

                return FieldMappingDefinition.GetField(Convert.ToString(prop.GetValue(fieldsMapping)));
            }));
        }