@Override public ProfileSummary createProfile(Profile profile) { User loggedInUser = userService.getLoggedInUser(); if (profile.getUserId() != null && profile.getUserId() == loggedInUser.getId() || authService.isUserAuthorized(ROLE_ADMIN, profile.getOrganizationId())) { return profilePersister.create(profile); } else { throw new NotAuthorizedException(); } }