Implemented backend logic for POST requests