String personId = validateWriteRequest(userId, groupId, appId, token);
//lock on this user and this application to avoid any potential concurrency issues
Lock lock = getApplicationDataLock(personId, appId);
try {
lock.lock();
//get the application data for this user and application
ApplicationData applicationData = applicationDataRepository.getApplicationData(personId, appId);
//if there is no data, create an empty object to store the data in that we'll save when we're done
if (applicationData == null) {