refactor types in post and comment controllers