diff --git a/src/grpc_client/models_accessor.py b/src/grpc_client/models_accessor.py
index b51ee90..918c04d 100644
--- a/src/grpc_client/models_accessor.py
+++ b/src/grpc_client/models_accessor.py
@@ -27,39 +27,46 @@
         Give a Model Class Name and some data, check if that exits or instantiate a new one
         """
 
-        if data.get('name'):
-            used_key = 'name'
-        else:
-            if len(data.keys()) > 0:
-                # FIXME apparently we're not matching model without a name field
-                used_key = data.keys()[0]
-            else:
-                used_key = None
+        # NOTE: we need to import this later as it's generated by main.py
+        from KEYS import TOSCA_KEYS
+
+        # get the key for this model
+        try:
+            filter_keys = TOSCA_KEYS[class_name]
+        except KeyError, e:
+            raise Exception("[XOS-TOSCA] Model %s doesn't have a tosca_key specified" % (class_name))
+
+        if len(filter_keys) == 0:
+            raise Exception("[XOS-TOSCA] Model %s doesn't have a tosca_key specified" % (class_name))
+
+        filter = {}
+        for k in filter_keys:
+            try:
+                filter[k] = data[k]
+            except KeyError, e:
+                raise Exception("[XOS-TOSCA] Model %s doesn't have a property for the specified tosca_key (%s)" % (class_name, e))
 
         key = "%s~%s" % (username, password)
         if not key in RESOURCES:
             raise Exception("[XOS-TOSCA] User '%s' does not have ready resources" % username)
         if class_name not in RESOURCES[key]:
-            raise Exception('[XOS-TOSCA] The model you are trying to create (%s: %s, class: %s) is not know by xos-core' % (used_key, data[used_key], class_name))
+            raise Exception('[XOS-TOSCA] The model you are trying to create (class: %s, properties, %s) is not know by xos-core' % (class_name, str(filter)))
 
         cls = RESOURCES[key][class_name]
-        if used_key:
-            models = cls.objects.filter(**{used_key: data[used_key]})
-        else:
-            # NOTE if we don't have a way to track the model, create a new one
-            models = []
+
+        models = cls.objects.filter(**filter)
 
         if len(models) == 1:
-            print "[XOS-Tosca] Model %s already exist, retrieving instance..." % data[used_key]
+            print "[XOS-Tosca] Model of class %s and properties %s already exist, retrieving instance..." % (class_name, str(filter))
             model = models[0]
         elif len(models) == 0:
 
             if 'must-exist' in data and data['must-exist']:
-                raise Exception("[XOS-TOSCA] Model %s:%s has property 'must-exist' but cannot be found" % (class_name, data[used_key]))
+                raise Exception("[XOS-TOSCA] Model of class %s and properties %s has property 'must-exist' but cannot be found" % (class_name, str(filter)))
 
             model = cls.objects.new()
-            print "[XOS-Tosca] Model %s is new, creating new instance..." % data[used_key] if used_key else class_name
+            print "[XOS-Tosca] Model (%s) is new, creating new instance..." % str(filter)
         else:
-            raise Exception("[XOS-Tosca] Model %s has multiple instances, I can't handle it" % data[used_key])
+            raise Exception("[XOS-Tosca] Model of class %s and properties %s has multiple instances, I can't handle it" % (class_name, str(filter)))
 
         return model
\ No newline at end of file
