static int registration(Scanner scanner, ObjectOutputStream toServer, ObjectInputStream fromServer, int accessLevel) throws IOException, ClassNotFoundException {
        log.debug("Start \"registration\" method");
        System.out.println("Input login:");
        String login = scanner.next().toLowerCase();
        System.out.println("Input password:");
        String password = scanner.next();
        RegistrationRequestInfo reg = new RegistrationRequestInfo(login, password, accessLevel);
        log.debug("Send RegistrationRequestInfo to server");
        toServer.writeObject(reg);


        Object o = fromServer.readObject();
        if (o instanceof RespondInfo) {
            if (((RespondInfo) o).getStatus() == RespondInfo.SERVER_ERROR_STATUS) {
                System.out.println("Server error");
                log.debug("Server error");
                return -2;
            } else if (o instanceof RegistrationRespondInfo) {
                RegistrationRespondInfo respond = (RegistrationRespondInfo) o;
                log.debug("Received RegistrationRespondInfo from server");

                switch (respond.getStatus()) {
                    case RegistrationRespondInfo.OK_STATUS: {
                        System.out.println("Registration successful");
                        log.debug("Registration successful");
                        return respond.getRights();
                    }
                    case RegistrationRespondInfo.DUPLICATED_LOGIN_STATUS: {
                        System.out.println("User with that login already exists");
                        log.debug("Duplicated login");
                        return respond.getRights();
                    }
                    default:
                        return -3;
                }
            }
        }
        log.error("Unknown object type");
        return -4;
    }