refactoring NSManagedObject+MAGCoreData. Added mock tests.