         switch self {
         case User(let child):
             
-            let url = baseURL.URLByAppendingPathComponent("/users")
+            let url = baseURL.URLByAppendingPathComponent("users")
             return child.url(url)
         case Deck(let child):
-            let url = baseURL.URLByAppendingPathComponent("/decks")
+            let url = baseURL.URLByAppendingPathComponent("decks")
             return child.url(url)
             
         case Flashcards(let child, let deckId):
-            let url = baseURL.URLByAppendingPathComponent("/decks/\(deckId)")
+            var url = baseURL.URLByAppendingPathComponent("decks")
+            url = url.URLByAppendingPathComponent(deckId)
             return child.url(url)
             
         }

    func url(baseURL: NSURL) -> NSURL {
        switch self {
        case .Post:
            return baseURL.URLByAppendingPathComponent("/flashcards")
        }
    }
}

enum DeckRoutes  {
    case Get(id:String?)
    
    func url(baseURL: NSURL) -> NSURL {
        switch self {
        case .Get(let id):
            if let id = id {
                return baseURL.URLByAppendingPathComponent("/\(id)")
            }
            return baseURL
        }
    }

        return true
    }
    
    func get<T: Object>(type: T.Type, withId idKey: String) -> T? {
        return realm?.objectForPrimaryKey(T.self, key: idKey)
    }
    
    func getAll<T: Object>(type: T.Type) -> [T] {
        return realm?.objects(T.self).toArray() ?? []
    }
    
    func filter<T: Object>(type: T.Type, predicate: String, args: AnyObject...) -> [T] {
        return realm?.objects(T.self).filter(predicate, args).toArray() ?? []
    }
    
    func update(object: Object) -> Bool {
