added validations and error messages for posts