Moved shared validation code into pkp/lib