WIP: still streamlining model manager queries and the API permissions functionality.