Looks like you forgot to replace this part with Core Persistence calls.