Break out cleanPostedData method from Library.