refactor to prepare for entities/posts relationship