public static void __assign(Object modified, Object newValue) {
if (newValue instanceof Resource && modified instanceof Entity) {
Resource v = (Resource) newValue;
if (((Object)v.__getController()) instanceof ThreadStagingArea) {
Entity m = (Entity) modified;
while (m instanceof Resource && m != newValue) {
m = ((Resource)m).__getController();
}
if (!(m instanceof Resource)) {
v.__setControl((Entity)modified);