Fix for object class validation

Fix for issue: https://github.com/realm/realm-cocoa/issues/1225 (There is code sample and full description)