private void GrantDirectoryPermissionForAccount(string accountName)
        {
            Trace.Entering();
            string groupName = _windowsServiceHelper.GetUniqueBuildGroupName();

            Trace.Info(StringUtil.Format("Calculated unique group name {0}", groupName));

            if (!_windowsServiceHelper.LocalGroupExists(groupName))
            {
                Trace.Info(StringUtil.Format("Trying to create group {0}", groupName));
                _windowsServiceHelper.CreateLocalGroup(groupName);
            }

            Trace.Info(StringUtil.Format("Trying to add userName {0} to the group {1}", accountName, groupName));
            _windowsServiceHelper.AddMemberToLocalGroup(accountName, groupName);

            // grant permssion for agent root folder
            string agentRoot = IOUtil.GetRootPath();

            Trace.Info(StringUtil.Format("Set full access control to group for the folder {0}", agentRoot));
            _windowsServiceHelper.GrantFullControlToGroup(agentRoot, groupName);

            // grant permssion for work folder
            string workFolder = IOUtil.GetWorkPath(HostContext);

            Directory.CreateDirectory(workFolder);
            Trace.Info(StringUtil.Format("Set full access control to group for the folder {0}", workFolder));
            _term.WriteLine(StringUtil.Loc("GrantingFilePermissions", accountName));
            _windowsServiceHelper.GrantFullControlToGroup(workFolder, groupName);
        }