+ /**
+ * Uniquely add branch office instance to allBranchOffices property
+ * <p>
+ * @param branchOffice Branch office being added
+ */
+ private void uniqueAddBranchOffice (final BranchOffice branchOffice) {
+ // Add instance to cache
+ this.branchOfficeCache.put(branchOffice.getBranchId(), branchOffice);
+
+ // Get iterator
+ final Iterator<BranchOffice> iterator = this.getAllBranchOffices().iterator();
+
+ // Iterate over all
+ while (iterator.hasNext()) {
+ // Get current element
+ final BranchOffice currentBranchOffice = iterator.next();
+
+ // Does primary key match?
+ if (Objects.equals(branchOffice.getBranchId(), currentBranchOffice.getBranchId())) {
+ // Yes then remove this one
+ iterator.remove();
+
+ // Re-add maybe updated version
+ this.getAllBranchOffices().add(branchOffice);
+
+ // Stop iteration
+ break;
+ }
+ }
+ }
+