public static string ImportProjects(TeisterMaskContext context, string xmlString)
        {
            var sb = new StringBuilder();

            var projects = new List <Project>();

            var projectDtos = XmlConverter
                              .Deserializer <ProjectInputModel>(xmlString, "Projects");

            foreach (var projectInfo in projectDtos)
            {
                if (!IsValid(projectInfo))
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                DateTime openDate;

                var isOpenDateValid = DateTime.TryParseExact(projectInfo.OpenDate, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out openDate);

                if (!isOpenDateValid)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                DateTime?dueDate = null;

                if (!string.IsNullOrEmpty(projectInfo.DueDate))
                {
                    DateTime dueDateValue;

                    var isDueDateValid = DateTime.TryParseExact(projectInfo.DueDate, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dueDateValue);

                    if (!isDueDateValid)
                    {
                        sb.AppendLine(ErrorMessage);
                        continue;
                    }

                    dueDate = dueDateValue;
                }

                var project = new Project
                {
                    Name     = projectInfo.Name,
                    OpenDate = openDate,
                    DueDate  = dueDate
                };


                foreach (var taskInfo in projectInfo.Tasks)
                {
                    if (!IsValid(taskInfo))
                    {
                        sb.AppendLine(ErrorMessage);
                        continue;
                    }

                    DateTime taskOpenDate;

                    var isTaskOpenDateValid = DateTime.TryParseExact(taskInfo.OpenDate, "dd/MM/yyyy", CultureInfo.InvariantCulture,
                                                                     DateTimeStyles.None, out taskOpenDate);

                    if (taskOpenDate < project.OpenDate)
                    {
                        sb.AppendLine(ErrorMessage);
                        continue;
                    }

                    DateTime taskDueDate;

                    var isTaskDueDateValid = DateTime.TryParseExact(taskInfo.DueDate, "dd/MM/yyyy", CultureInfo.InvariantCulture,
                                                                    DateTimeStyles.None, out taskDueDate);

                    if (!isTaskDueDateValid)
                    {
                        sb.AppendLine(ErrorMessage);
                        continue;
                    }

                    if (dueDate.HasValue && (taskDueDate > project.DueDate))
                    {
                        sb.AppendLine(ErrorMessage);
                        continue;
                    }

                    var task = new Task
                    {
                        Name          = taskInfo.Name,
                        OpenDate      = taskOpenDate,
                        DueDate       = taskDueDate,
                        ExecutionType = (ExecutionType)taskInfo.ExecutionType,
                        LabelType     = (LabelType)taskInfo.LabelType
                    };

                    project.Tasks.Add(task);
                }

                projects.Add(project);

                sb.AppendLine(string.Format(SuccessfullyImportedProject, project.Name, project.Tasks.Count));
            }

            context.Projects.AddRange(projects);

            context.SaveChanges();

            return(sb.ToString().TrimEnd());
        }