added a couple of methods to MediaType and fixed bug with null reference when using ReadWriteClassFactory with null attributes