Refactored GlobalTenantMiddleware
Made abstract tenant model pickleable.