private static Tuple<string, Type> GetTypeDetailsFromMember(MemberInfo memberInfo)
 {
     var name = memberInfo.Name;
     Type datatype = null;
     memberInfo.TryAs<PropertyInfo>(property => datatype = property.PropertyType);
     memberInfo.TryAs<FieldInfo>(field => datatype = field.FieldType);
     if (datatype == null)
         throw new ArgumentOutOfRangeException("memberInfo", "Only Fields and Properties can be serialized!");
     return new Tuple<string, Type>(name, datatype);
 }