VOL-1372 : Fixed core crash due to how revisions are updated

- UpdateChildren merges new and existing entries
- proxy access control singleton now uses sync.Map since the
  entry was intermittently losing its content
- Switch to AddWithID in the device_agent to ensure thread safety

Change-Id: Ifcb2374f48b612a487a00f4a952aeec21d1c4af1
diff --git a/db/model/node.go b/db/model/node.go
index bcda91e..017f121 100644
--- a/db/model/node.go
+++ b/db/model/node.go
@@ -810,10 +810,10 @@
 			var children []Revision
 			children = make([]Revision, len(rev.GetChildren()[name]))
 			copy(children, rev.GetChildren()[name])
-			_, childRev := n.findRevByKey(children, field.Key, keyValue)
-			childNode := childRev.GetNode()
-
-			return childNode.createProxy(path, fullPath, n, exclusive)
+			if _, childRev := n.findRevByKey(children, field.Key, keyValue); childRev != nil {
+				childNode := childRev.GetNode()
+				return childNode.createProxy(path, fullPath, n, exclusive)
+			}
 		} else {
 			log.Error("cannot index into container with no keys")
 		}
@@ -823,6 +823,7 @@
 		return childNode.createProxy(path, fullPath, n, exclusive)
 	}
 
+	log.Warnf("Cannot create proxy - latest rev:%s, all revs:%+v", rev.GetHash(), n.GetBranch(NONE).Revisions)
 	return nil
 }