// this function checks if the current user is already registerd if not save the user to the data.
        public InfoObject register()
        {
            InfoObject info;

            if (DataLayerUser2.open(getEmail()) == null)
            {
                this.lastBoardClosed = new Board(email, "Main");
                myBoards.Add("Main", this.lastBoardClosed);
                this.boardsCollection = lastBoardClosed.getBoardName();
                save();
                addColumn(getEmail(), "Backlog");
                addColumn(getEmail(), "In progress");
                addColumn(getEmail(), "Done");
                lastBoardClosed.save();
                Log.Info("The user " + getEmail() + " registered.");
                info = new InfoObject(true, "The user " + getEmail() + " registered.");
                return(info);
            }
            else
            {
                Log.Info("The user " + getEmail() + " can't register because this email is already in use.");
                info = new InfoObject(false, "The user " + getEmail() + " can't register because this email is already in use.");
                return(info);
            }
        }
        // this function return User object from the data layer.
        public static User getByEmail(string email)
        {
            UserD openedUser   = DataLayerUser2.open(email);
            User  returnedUser = null;

            if (openedUser != null)
            {
                returnedUser = new User(openedUser.getEmail(), openedUser.getPassword());
                returnedUser.setIsLoggedIn(openedUser.isLoggedIn());
                returnedUser.setNumberOfTasksAdded(openedUser.getNumOfTasksAdded());
                //returnedUser.setBoardsCollection(openedUser.getExistingBoards());

                LinkedList <BoardD> ListBoardD = DataLayerBoard2.Open(email);
                String boardsList = "";
                foreach (BoardD boardD in ListBoardD)
                {
                    Board b = new Board(email, boardD.getName());
                    b.setNumOfTasks(boardD.getNumberOfTasks());
                    b.open(email);
                    myBoards.Add(b.getBoardName(), b);
                    boardsList += "+" + boardD.getName();
                }
                returnedUser.setBoardsCollection(boardsList);
                returnedUser.setCurrBoard(openedUser.getLastBoard());
            }
            return(returnedUser);
        }