@Override
	public boolean validateUsernameAndPassword(String username, String password) throws StorageException {
		ResultSet rs = null;
	    Connection conn = null;
	    PreparedStatement pstmt = null;
	    boolean validUser = false;
	    int checkUser = 0;
	    
	    try {
			conn = Database.getConnection();
			
			String query = "SELECT count(*) as valid_user "
						 + "FROM users "
						 + "WHERE users.email = ? "
						 + "AND users.password = ?;";
		
			pstmt = conn.prepareStatement(query);
			
			pstmt.setString(1, username);
			pstmt.setString(2, password);
			
			rs = pstmt.executeQuery();
			
			// Display all the data in the table.
			while (rs.next()) {
				checkUser = rs.getInt("valid_user");
				
				if(checkUser > 0) {
					validUser = true;
				} else {
					validUser = false;
				}
	        }
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			throw new StorageException(e.getMessage());
		} catch (SQLException e) {
			e.printStackTrace();
			throw new StorageException(e.getMessage());
		} finally {
			try {
				if(rs != null) {
					rs.close();
				}
				if(pstmt != null) {
					pstmt.close();
				}
				if(conn != null) {
					conn.close();
				}
			} catch (SQLException e) {
				e.printStackTrace();
				throw new StorageException(e.getMessage());
			}
		}
	    
	    return validUser;
	}