public void updatePages() throws InvalidMenuException{
		int totalPages = pages.size();
		List<Page> sorted = new ArrayList<Page>();
		for(int i = 0; i < totalPages; i++){
			sorted.add(Page.NULL_PAGE);
		}
		boolean[] missing = new boolean[totalPages];
		for(int i = 0; i < missing.length; i++){
			missing[i] = true;
		}
		for(Page page : pages){
			int arrayIndex = page.getPageNumber() - 1;
			missing[arrayIndex] = false;
			sorted.set(arrayIndex, page);
		}
		for(boolean m : missing){
			if(m){
				throw new InvalidMenuException("Missing pages");
			}
		}
		pages = sorted;
	}