moved functionality from view new-post to controller post