         }
         if inside == false {
             assertionFailure("You did not register the model type \(type.modelName)");
-            return;
+            return false;
         }
         
-        
+        var alreadyInCache: Bool = false;
         let name = type.modelName;
         if var cache = self.cache[name] {
-            var foundIn: Bool = false;
             var foundIndex: Int = -1;
             for (i, m) in self.cache[name]!.enumerated() {
                 if model.id == m.id {
-                    foundIn = true;
+                    alreadyInCache = true;
                     foundIndex = i;
                 }
             }
-            if foundIn {
+            if alreadyInCache {
                 self.cache[name]![foundIndex] = model;
             } else {
                 cache.append(model);

        
        model.isInCache = true;
        self.saveCache();
    }
    
    /// load everything in the cache

        super.init();
    }
    
    /// add a model to the cache
    ///
    /// - Returns: returns true if the model was added to the cache, false if it was already in the cache
    public func addToCache() -> Bool {
        if self.isInCache == true {
            return false;
        }
        return PSModelCache.shared.addModelToCache(model: self);
    }
    
    
