Feature/optimize

@wilduck this fixes a critical issue when syncing all entities. Sometimes entities were cached when they were synced, but their relationships were not synced causing some entities to not be mirrored properly. Will merge and release this asap