 +    my $updatedpatron = eval {
 +        $patron->set($body);
 +    };
++
++    # Do a live-sync with NL. Will be retried by cron-job if it fails.
++    if ($nlsync) {
++        NLSync({ 'borrowernumber' => $args->{borrowernumber} });
++    }
 +
 +    if ($updatedpatron) {
 +        if ($updatedpatron->is_changed) {

+    } else {
+        $patrons = Koha::Patrons->search;
+    }
 
     $c->$cb($patrons->unblessed, 200);
 }
@@ -34,8 +44,6 @@ sub list {
 sub get {
     my ($c, $args, $cb) = @_;
 
-    my $user = $c->stash('koha.user');
-
     my $patron = Koha::Patrons->find($args->{borrowernumber});
     unless ($patron) {
         return $c->$cb({error => "Patron not found"}, 404);
@@ -44,4 +52,127 @@ sub get {
     return $c->$cb($patron->unblessed, 200);
 }
 
+sub add {
+    my ($c, $args, $cb) = @_;
+

+            return $c->$cb({error => "Patron category \"" . $body->{categorycode} . "\" does not exist"}, 404);
+        }
+    }
+
+    # Update the hahsed_pin needed for NL-syncronization while we have the password in cleartext.
+    my $nlsync;
+    if ( $body->{password} && C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
+        my $sync = NLGetSyncDataFromBorrowernumber( $args->{borrowernumber} );
+        if ( $sync ) {
+            $sync->update({ 'syncstatus' => 'edited', 'hashed_pin' => NLEncryptPIN( $body->{password} ) });
+            $nlsync = 1;
+        }
+    }
+
+    # ALL OK - Update patron
+    # Perhaps limit/validate what should be updated here? flags, et.al.
+    if ($body->{password}) { $body->{password} = hash_password($body->{password}) }; # bcrypt password if given
