Split huge function that updates records

Change-Id: I8f4968c70423df929f82dd99a89530235aef4ecb
Merge "Split huge function that updates records"