private void SealExitWithADoor(ModuleConnector baseExit)
    {
        //Debug.Log("Couldn't find any possible combination. Sealing off the exit with a door");
        var newModule = ProBuilder.Instantiate(DoorPrefab.gameObject, Vector3.zero, Quaternion.identity).GetComponent <Module>();

        newModule.transform.parent = DungeonGameObject.transform;
        var doorExit = newModule.GetExits()[0];

        MatchExits(baseExit, doorExit);

        baseExit.ConnectWith(doorExit);
        doorExit.ConnectWith(baseExit);
    }
    /**
     * The only scenario where CreateNewModule would return false, is if there was no way to generate a module, so we have to seal it off with a door
     */
    private bool CreateNewModule(ModuleConnector baseExit, List <GameObject> availableModulePrefabs, List <ModuleConnector> newExits, out GameObject moduleGameObject)
    {
        bool            foundExit     = false;
        bool            foundModule   = false;
        ModuleConnector newModuleExit = null;

        ModuleConnector[] newModuleExits = null;
        moduleGameObject = null;
        Module newModule = null;

        foreach (var newModulePrefab in availableModulePrefabs)
        {
            //Create the new module prefab
            newModule = ProBuilder.Instantiate(newModulePrefab, Vector3.zero, Quaternion.identity).GetComponent <Module>();
            newModule.transform.parent = DungeonGameObject.transform;
            newModuleExits             = newModule.GetExits();
            Util.ShuffleArray(newModuleExits);

            for (var i = 0; i < newModuleExits.Count(); i++)
            {
                newModuleExit = newModuleExits[i];

                //Match the exits
                MatchExits(baseExit, newModuleExit);

                //Letting a full frame go by so we can do a collision check
                if (CollisionCheck(newModule, baseExit))
                {
                    foundModule = true;
                    foundExit   = true;
                    break;
                }
            }

            //We've tried every exit combination with this module, get a new module
            if (!foundExit)
            {
                Destroy(newModule.gameObject);
                continue;
            }

            //if we've reached here, we have found a suitable exit with a suitable module, or we have not found anything suitable.
            break;
        }

        //We haven't found anything useful. Just make a door, and find another baseModuleExit
        if (!foundModule)
        {
            return(false);
        }

        //the new module was received. All is good. Connect with the base module exit. Find another baseModuleExit to connect with
        baseExit.ConnectWith(newModuleExit);
        newModuleExit.ConnectWith(baseExit);

        if (newExits != null)
        {
            newExits.AddRange(newModuleExits.Where(e => e != newModuleExit));
        }

        CameraPortal cameraPortal = (CameraPortal)newModule.gameObject.GetComponentInChildren(typeof(CameraPortal));

        if (cameraPortal != null)
        {
            Portals.Add(cameraPortal);
        }

        moduleGameObject = newModule.gameObject;
        return(true);
    }