@Override
    public boolean save(User user) {
        boolean isNewUser = true;
        long lastUserId = 0;
        List<User> users = new ArrayList<User>();
        try {
            BufferedReader reader = new BufferedReader(new FileReader(file));
            
            for (String s = reader.readLine(); s != null; s = reader.readLine()) {
                User newUser = new User();
                long userId = Long.parseLong(s);
                if (userId > lastUserId) {
                    lastUserId = userId;
                }
                newUser.setId(userId);
                newUser.setLogin(reader.readLine());
                newUser.setPassword(reader.readLine());
                newUser.setFullName(reader.readLine());
                users.add(newUser);
            }

            if (!users.isEmpty()) {
                for (User u : users) {
                    if (u.getLogin().equals(user.getLogin())) {
                        u.setFullName(user.getFullName());
                        u.setPassword(user.getPassword());
                        isNewUser = false;
                        break;
                    }
                }
            }

            if (isNewUser) {
                user.setId(lastUserId + 1);
                users.add(user);
            }
            IOUtils.closeQuietly(reader);
            
            FileWriter writer = new FileWriter(file);
            for (User u : users) {
                writer.write(u.getId() + "\n");
                writer.write(u.getLogin() + "\n");
                writer.write(u.getPassword() + "\n");
                writer.write(u.getFullName() + "\n");
            }
            IOUtils.closeQuietly(writer);
            return true;
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;
    }