[Refactor] Move function getOffsetPosition to commonHelper

- Also, changed its return type and make correponding changes