@Override
 public synchronized UsersWorkspaceImpl update(UsersWorkspaceImpl workspace)
     throws NotFoundException, ConflictException, ServerException {
   if (!workspaces.containsKey(workspace.getId())) {
     throw new NotFoundException("Workspace with id " + workspace.getId() + " was not found");
   }
   workspace.setStatus(null);
   workspaces.put(workspace.getId(), doClone(workspace));
   return workspace;
 }
 @Override
 public synchronized UsersWorkspaceImpl create(UsersWorkspaceImpl workspace)
     throws ConflictException, ServerException {
   if (workspaces.containsKey(workspace.getId())) {
     throw new ConflictException("Workspace with id " + workspace.getId() + " already exists");
   }
   if (find(workspace.getName(), workspace.getOwner()).isPresent()) {
     throw new ConflictException(
         format(
             "Workspace with name %s and owner %s already exists",
             workspace.getName(), workspace.getOwner()));
   }
   workspace.setStatus(null);
   workspaces.put(workspace.getId(), doClone(workspace));
   return workspace;
 }
 private UsersWorkspaceImpl doClone(UsersWorkspaceImpl workspace) {
   UsersWorkspaceImpl copyWorkspace =
       new UsersWorkspaceImpl(
           workspace.getId(),
           workspace.getName(),
           workspace.getOwner(),
           new HashMap<>(workspace.getAttributes()),
           new ArrayList<>(workspace.getCommands()),
           new ArrayList<>(workspace.getProjects()),
           new ArrayList<>(workspace.getEnvironments()),
           workspace.getDefaultEnv(),
           workspace.getDescription());
   copyWorkspace.setStatus(workspace.getStatus());
   copyWorkspace.setTemporary(workspace.isTemporary());
   return copyWorkspace;
 }