         guard let warp = Warp.shared else {
             fatalError("WarpServer is not yet initialized")
         }
-        let _ = Warp.API.get(warp.generateEndpoint(.logout), parameters: nil, headers: warp.HEADER()).warpResponse { (warpResult) in
+        
+        let endPoint = warp.generateEndpoint(.logout)
+        
+        let request = Warp.API.get(endPoint, parameters: nil, headers: warp.HEADER())
+        
+        _ = request.warpResponse { (warpResult) in
             switch warpResult {
             case .success(let JSON):
                 let warpResponse = WarpResponse(json: JSON, result: [String: Any].self)
                 switch warpResponse.statusType {
                 case .success:
-                    WarpUser.deleteCurrent()
+                    Warp.User.deleteCurrent()
                     completion(true, nil)
                 default:
                     completion(true, WarpError(message: warpResponse.message, status: warpResponse.status))

    }
}

// MARK: - Persistence
extension WarpUser {
    internal func setCurrentUser() {
        var strings: [String] = []
        for key in self.objects.keys {
            strings.append(key)
        }
        
        UserDefaults.standard.set(strings, forKey: "swrxCurrentUserKeys_rbBEAFVAWFBVWW")
        for (key, value) in self.objects {
            UserDefaults.standard.set(value, forKey: "swrxCurrentUser\(key)_9gehrpnvr2pv3r")
        }
    }
    
    public static func current() -> WarpUser? {
        let user: WarpUser = WarpUser()
        let keys: [String] = UserDefaults.standard.array(forKey: "swrxCurrentUserKeys_rbBEAFVAWFBVWW") as? [String] ?? []
        
        if keys.count == 0 {


import Foundation


public extension Warp {
    public class User: Warp.Object {
    
        public required init() {
            super.init(className: "user")
        }
        
        override public func set(object value: Any, forKey: String) -> Self {
            if forKey == "session_token" {
                fatalError("This action is not permitted")
            } else {
                _ = super.set(object: value, forKey: forKey)
                return self
            }
        }
        
        public func set(username: String) -> Self {
            return self.set(object: username, forKey: "username")
        }
        
        public func set(password: String) -> Self {
            return self.set(object: password, forKey: "password")
        }
        
        public func set(email: String) -> Self {
            return self.set(object: email, forKey: "email")
        }
        
        public required init(className: String) {
            super.init(className: "user")
        }
        
        required public init(className: String, json: [String : Any]) {
            super.init(className: "user", json: json)
        }
        
        public override class func createWithoutData(id: Int, className: String = "") -> Warp.User {
            let user = Warp.User()
            user.dictionary["id"] = id
            return user
        }
        
        /// Creates a Warp.Query instance for this user
        public func query() -> Warp.Query<Warp.User> {
            return Warp.Query<Warp.User>()
        }
        
        override public func save(_ completion: @escaping WarpResultBlock = ({ _, _ in })) -> WarpDataRequest {
            guard let warp = Warp.shared else {
                fatalError("WarpServer is not yet initialized")
            }
            
            let endPoint: String = {
                if self.id > 0 {
                    return warp.generateEndpoint(.users(id: self.id))
                } else {
                    return warp.generateEndpoint(.users(id: nil))
                }
            }()
            
            let request: WarpDataRequest = {
                if self.id > 0 {
                    return Warp.API.put(endPoint, parameters: self.dictionary, headers: warp.HEADER())
                } else {
                    return Warp.API.post(endPoint, parameters: self.dictionary, headers: warp.HEADER())
                }
            }()
            
            return request.warpResponse { (warpResult) in
                switch warpResult {
                case .success(let JSON):
                    let warpResponse = WarpResponse(json: JSON, result: [String: Any].self)
                    switch warpResponse.statusType {
                    case .success:
                        self.dictionary = warpResponse.result!
                        completion(true, nil)
                    default:
                        completion(true, WarpError(message: warpResponse.message, status: warpResponse.status))
                    }
                    break
                case .failure(let error):
                    completion(false, error)
                }
            }
        }
        
        override public func destroy(_ completion: @escaping WarpResultBlock = ({ _, _ in })) -> WarpDataRequest {
            guard let warp = Warp.shared else {
                fatalError("WarpServer is not yet initialized")
            }
            
            let endPoint = warp.generateEndpoint(.users(id: self.id))
            
            let request = Warp.API.delete(endPoint, parameters: self.dictionary, headers: warp.HEADER())
            
            guard self.id > 0 else {
                completion(false, WarpError(code: .objectDoesNotExist))
                return request
            }
            
            return request.warpResponse { (warpResult) in
                switch warpResult {
                case .success(let JSON):
                    let warpResponse = WarpResponse(json: JSON, result: [String: Any].self)
                    switch warpResponse.statusType {
                    case .success:
                        self.dictionary = warpResponse.result!
                        completion(true, nil)
                    default:
                        completion(true, WarpError(message: warpResponse.message, status: warpResponse.status))
