Handle both Get and POST methods