Refactor update operation to single and bulk

Refactor update operation into bulk and single to keep complicated logic separate.