Merge branch 'release/2.13'
diff --git a/pom.xml b/pom.xml
index 598ea34..cbd26bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
 
   <groupId>edu.psu.swe.scim</groupId>
   <artifactId>scim-parent</artifactId>
-  <version>2.12</version>
+  <version>2.13</version>
   <packaging>pom</packaging>
   <name>SCIM - Parent</name>
   <description>Penn State's Open Source JavaEE implmentation of the SCIM version 2.0 specification (RFC7642, RFC7643 and RFC7644)</description>
diff --git a/scim-client/pom.xml b/scim-client/pom.xml
index b8b90fc..e81306d 100644
--- a/scim-client/pom.xml
+++ b/scim-client/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
   <artifactId>scim-client</artifactId>
   <name>SCIM - Client</name>
diff --git a/scim-common/pom.xml b/scim-common/pom.xml
index 757a853..0ec0d8c 100644
--- a/scim-common/pom.xml
+++ b/scim-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-common</artifactId>
@@ -14,12 +14,12 @@
     <dependency>
       <groupId>edu.psu.swe.scim</groupId>
       <artifactId>scim-spec-protocol</artifactId>
-      <version>2.12</version>
+      <version>2.13</version>
     </dependency>
     <dependency>
       <groupId>edu.psu.swe.scim</groupId>
       <artifactId>scim-spec-schema</artifactId>
-      <version>2.12</version>
+      <version>2.13</version>
     </dependency>
   </dependencies>
 
diff --git a/scim-compliance/pom.xml b/scim-compliance/pom.xml
index 61bc562..e822608 100644
--- a/scim-compliance/pom.xml
+++ b/scim-compliance/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-compliance</artifactId>
diff --git a/scim-compliance/scim-compliance-client/pom.xml b/scim-compliance/scim-compliance-client/pom.xml
index 062be4d..b917371 100644
--- a/scim-compliance/scim-compliance-client/pom.xml
+++ b/scim-compliance/scim-compliance-client/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-compliance</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-compliance-client</artifactId>
diff --git a/scim-compliance/scim-compliance-server/pom.xml b/scim-compliance/scim-compliance-server/pom.xml
index 689043e..92f5785 100644
--- a/scim-compliance/scim-compliance-server/pom.xml
+++ b/scim-compliance/scim-compliance-server/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-compliance</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-compliance-server</artifactId>
diff --git a/scim-errai/pom.xml b/scim-errai/pom.xml
index 484130a..f34fc6e 100644
--- a/scim-errai/pom.xml
+++ b/scim-errai/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-errai</artifactId>
diff --git a/scim-server/pom.xml b/scim-server/pom.xml
index f1b7815..eb0cee2 100644
--- a/scim-server/pom.xml
+++ b/scim-server/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-server</artifactId>
diff --git a/scim-server/scim-server-common/pom.xml b/scim-server/scim-server-common/pom.xml
index 80f9213..8bbb1be 100644
--- a/scim-server/scim-server-common/pom.xml
+++ b/scim-server/scim-server-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-server-common</artifactId>
diff --git a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java
index 74086df..f21c86d 100644
--- a/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java
+++ b/scim-server/scim-server-common/src/main/java/edu/psu/swe/scim/server/provider/UpdateRequest.java
@@ -4,6 +4,7 @@
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -120,16 +121,16 @@
     if (!initialized) {
       throw new IllegalStateException("UpdateRequest was not initialized");
     }
-
-    if (patchOperations != null) {
-      return patchOperations;
+    
+    if (patchOperations == null) {
+      try {
+        patchOperations = createPatchOperations(); 
+      } catch (IllegalArgumentException | IllegalAccessException e) {
+        throw new IllegalStateException("Error creating the patch list", e);
+      }
     }
-
-    try {
-      return createPatchOperations();
-    } catch (IllegalArgumentException | IllegalAccessException e) {
-      throw new IllegalStateException("Error creating the patch list", e);
-    }
+    
+    return patchOperations;
   }
 
   private void sortMultiValuedCollections(Object t, AttributeContainer ac) throws IllegalArgumentException, IllegalAccessException {
@@ -400,7 +401,8 @@
       ++i;
     }
     
-    if (patchOpType == Type.REPLACE && parseData.resourceObject == null) {
+    if (patchOpType == Type.REPLACE && (parseData.resourceObject == null || 
+        (parseData.resourceObject instanceof Collection && ((Collection<?>)parseData.resourceObject).isEmpty()))) {
       patchOpType = Type.REMOVE;
       valueNode = null;
     }
@@ -471,7 +473,6 @@
     Object resourceObject;
     AttributeContainer ac;
     String pathUri;
-    int addRemoveOffset = 0;
 
     public ParseData(String diffPath) {
       String path = diffPath.substring(1);
diff --git a/scim-server/scim-server-example/pom.xml b/scim-server/scim-server-example/pom.xml
index f8984ed..387c3f9 100644
--- a/scim-server/scim-server-example/pom.xml
+++ b/scim-server/scim-server-example/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-server-examples</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-couchdb/pom.xml b/scim-server/scim-server-example/scim-server-couchdb/pom.xml
index 4664c4c..8c71b5b 100644
--- a/scim-server/scim-server-example/scim-server-couchdb/pom.xml
+++ b/scim-server/scim-server-example/scim-server-couchdb/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-server-couchdb</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-memory/pom.xml b/scim-server/scim-server-example/scim-server-memory/pom.xml
index 12af38f..268c966 100644
--- a/scim-server/scim-server-example/scim-server-memory/pom.xml
+++ b/scim-server/scim-server-example/scim-server-memory/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-server-memory</artifactId>
diff --git a/scim-server/scim-server-example/scim-server-rdbms/pom.xml b/scim-server/scim-server-example/scim-server-rdbms/pom.xml
index 7f7b5ad..463f919 100644
--- a/scim-server/scim-server-example/scim-server-rdbms/pom.xml
+++ b/scim-server/scim-server-example/scim-server-rdbms/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-server-examples</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-server-rdbms</artifactId>
diff --git a/scim-spec/pom.xml b/scim-spec/pom.xml
index fea3f6d..de41533 100644
--- a/scim-spec/pom.xml
+++ b/scim-spec/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-spec</artifactId>
diff --git a/scim-spec/scim-spec-protocol/pom.xml b/scim-spec/scim-spec-protocol/pom.xml
index 57680f6..16d8799 100644
--- a/scim-spec/scim-spec-protocol/pom.xml
+++ b/scim-spec/scim-spec-protocol/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-spec</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-spec-protocol</artifactId>
diff --git a/scim-spec/scim-spec-schema/pom.xml b/scim-spec/scim-spec-schema/pom.xml
index 8bf9273..14dfc51 100644
--- a/scim-spec/scim-spec-schema/pom.xml
+++ b/scim-spec/scim-spec-schema/pom.xml
@@ -4,7 +4,7 @@
 	<parent>
 		<groupId>edu.psu.swe.scim</groupId>
 		<artifactId>scim-spec</artifactId>
-		<version>2.12</version>
+		<version>2.13</version>
 	</parent>
 
 	<artifactId>scim-spec-schema</artifactId>
diff --git a/scim-tools/pom.xml b/scim-tools/pom.xml
index 0226036..3d0e9e5 100644
--- a/scim-tools/pom.xml
+++ b/scim-tools/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-parent</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-tools</artifactId>
diff --git a/scim-tools/scim-tools-cli/pom.xml b/scim-tools/scim-tools-cli/pom.xml
index 4721d41..87537f8 100644
--- a/scim-tools/scim-tools-cli/pom.xml
+++ b/scim-tools/scim-tools-cli/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-tools-cli</artifactId>
diff --git a/scim-tools/scim-tools-common/pom.xml b/scim-tools/scim-tools-common/pom.xml
index 0eda31a..7ab83de 100644
--- a/scim-tools/scim-tools-common/pom.xml
+++ b/scim-tools/scim-tools-common/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-tools-common</artifactId>
diff --git a/scim-tools/scim-tools-studio/pom.xml b/scim-tools/scim-tools-studio/pom.xml
index 419bd16..8e4e113 100644
--- a/scim-tools/scim-tools-studio/pom.xml
+++ b/scim-tools/scim-tools-studio/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>edu.psu.swe.scim</groupId>
     <artifactId>scim-tools</artifactId>
-    <version>2.12</version>
+    <version>2.13</version>
   </parent>
 
   <artifactId>scim-tools-studio</artifactId>