public void PopulateDocument(int markId, MemoryStream memory)
        {
            var mark = _markRepo.GetById(markId);

            if (mark == null)
            {
                throw new ArgumentNullException(nameof(mark));
            }
            var subnode = mark.Subnode;
            var node    = subnode.Node;
            var project = node.Project;

            var departmentHead = _employeeRepo.GetByDepartmentIdAndPosition(
                mark.Department.Id, _appSettings.DepartmentHeadPosId);

            if (departmentHead == null)
            {
                departmentHead = _employeeRepo.GetByDepartmentIdAndPosition(
                    mark.Department.Id, _appSettings.ActingDepartmentHeadPosId);
            }
            if (departmentHead == null)
            {
                departmentHead = _employeeRepo.GetByDepartmentIdAndPosition(
                    mark.Department.Id, _appSettings.DeputyDepartmentHeadPosId);
            }
            if (departmentHead == null)
            {
                departmentHead = _employeeRepo.GetByDepartmentIdAndPosition(
                    mark.Department.Id, _appSettings.ActingDeputyDepartmentHeadPosId);
            }
            if (departmentHead == null)
            {
                throw new ConflictException();
            }

            var constructions         = _constructionRepo.GetAllByMarkId(markId);
            var standardConstructions = _standardConstructionRepo.GetAllByMarkId(markId);

            using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(memory, true))
            {
                var markName = MarkHelper.MakeMarkName(
                    project.BaseSeries, node.Code, subnode.Code, mark.Code);
                (var complexName, var objectName) = MarkHelper.MakeComplexAndObjectName(
                    project.Name, node.Name, subnode.Name, mark.Name);

                AppendConstructionToTable(wordDoc,
                                          constructions.ToList(),
                                          standardConstructions.ToList());
                Word.AppendToMediumFooterTable(
                    wordDoc,
                    markName,
                    complexName,
                    objectName,
                    mark,
                    departmentHead);
                Word.AppendToSmallFooterTable(wordDoc, markName);
            }
        }