if (Validation::parent($parent) !== true) {
            $status_msg[] = 'Invalid parent ID';
        }
        // Validate author name
        if (Validation::username($author_name) !== true) {
            $status_msg[] = 'Invalid name';
        }
        // Validate email address
        if (Validation::email($author_email) !== true) {
            $status_msg[] = 'Invalid email address';
        }
        // If all user provided data is valid and trimmed
        if ($status_msg === array()) {
            $comment_handler = new CommentHandler();
            // Insert the comment
            if (($msg_id = $comment_handler->insert_comment($sid, $msg, $parent, $author_name, $author_email)) !== false) {
                $response = array('status_code' => 0, 'message_id' => $msg_id, 'author' => $author_name);
            } else {
                $response = array('status_code' => 4, 'status_msg' => array('An error has been occurred'));
            }
        } else {
            $response = array('status_code' => 3, 'status_msg' => $status_msg);
        }
    } else {
        $response = array('status_code' => 2, 'status_msg' => array('You must fill all fields'));
    }
} else {
    $response = array('status_code' => 1, 'status_msg' => array('An error has been occurred'));
}
header('Content-type: application/json');
echo json_encode($response);