@Override
	public TheaterSeatsReplyMessage seatsRequest(int clientID, int theaterID) throws RemoteException{
		
		TheaterSeats seats = null;
		TheaterSeatsReplyMessage reply = null;
		seats = cache.getTheaterSeats(theaterID);
	
		if(seats == null){
			
			//Creates a communication channel between this and the DBServer
			CommunicationController databaseCC;
			try {
				databaseCC = new CommunicationController(new Socket(this.dbAddress, this.dbPort));
			} catch (UnknownHostException e) {
				return new TheaterSeatsReplyMessage(theaterID, null);
			} catch (IOException e) {
				return new TheaterSeatsReplyMessage(theaterID, null);
			}
			
			reply = Skeleton.getTheater(new TheaterSeatsRequestMessage(theaterID), databaseCC);
			databaseCC.closeConnection();
			
			//If has not occurred an error it puts the theaters seats to cache.
			seats = reply.getTheaterSeats();
			if(seats != null){
				//Updates the seats so they are reserved
				int reservation = seats.getFirstFreeSeat();
				if(reservation != -1)
					seats.setSeatStatus(reservation/40, reservation%40, 'R');
				
				reply.setReservation(reservation);
				cache.addTheaterSeats(seats);
				cache.addReservedSeat(clientID, theaterID, reservation);
			}
			
			

		}
		else{
			//Updates the seats so they are reserved
			int reservation = seats.getFirstFreeSeat();
			if(reservation != -1){
				seats.setSeatStatus(reservation/40, reservation%40, 'R');
				cache.addReservedSeat(clientID, theaterID, reservation);
			}
			reply = new TheaterSeatsReplyMessage(theaterID, seats);
			reply.setReservation(reservation);
		}
		
		//If an error occurred the reply == null and it is returned
		return reply;
	}