Handles validation of user input (server side).