@Override
  protected RemoteOperationResult run(OwnCloudClient client) {

    OCShare share = getStorageManager().getShareById(mShareId); // ShareType.USER | ShareType.GROUP

    if (share == null) {
      // TODO try to get remote share before failing?
      return new RemoteOperationResult(RemoteOperationResult.ResultCode.SHARE_NOT_FOUND);
    }

    mPath = share.getPath();

    // Update remote share with password
    UpdateRemoteShareOperation updateOp = new UpdateRemoteShareOperation(share.getRemoteId());
    updateOp.setPermissions(mPermissions);
    RemoteOperationResult result = updateOp.execute(client);

    if (result.isSuccess()) {
      RemoteOperation getShareOp = new GetRemoteShareOperation(share.getRemoteId());
      result = getShareOp.execute(client);
      if (result.isSuccess()) {
        share = (OCShare) result.getData().get(0);
        // TODO check permissions are being saved
        updateData(share);
      }
    }

    return result;
  }
 private void updateData(OCShare share) {
   // Update DB with the response
   share.setPath(mPath); // TODO - check if may be moved to UpdateRemoteShareOperation
   if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) {
     share.setIsFolder(true);
   } else {
     share.setIsFolder(false);
   }
   getStorageManager().saveShare(share);
 }