public static int createMessage(Connection con, int sender_id,
			int recipient_id, int type, String body) throws SQLException {
		Statement statement = con.createStatement();
		String created_on = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
				.format(Calendar.getInstance().getTime());
		PreparedStatement pStmt = con
				.prepareStatement("INSERT INTO messages VALUES (NULL, ?, ?, ?, ?, ?)");
		pStmt.setInt(1, sender_id);
		pStmt.setInt(2, recipient_id);
		pStmt.setString(3, body);
		pStmt.setString(4, created_on);
		pStmt.setBoolean(5, false);
		pStmt.executeUpdate();
		ResultSet rs = statement.executeQuery("SELECT LAST_INSERT_ID()");
		rs.first();

		return rs.getInt("LAST_INSERT_ID()");
	}