move logic to application helper