public override async Task <ProjectDto> Create(ProjectDto input)
        {
            CheckCreatePermission();
            ValidateProjectName(input.ProjectName);

            Project projectEntity = MapToEntity(input);
            bool    existsInDB    = projectRepository.GetAll().Any(a => a.ProjectName == projectEntity.ProjectName && a.ProjectAreaPath == projectEntity.ProjectAreaPath);

            if (existsInDB)
            {
                throw new UserFriendlyException("Project Was Registered Before!");
            }

            #region CheckWorkspaceExist & CreateWorkspace
            if (!string.IsNullOrEmpty(input.WorkspaceName))
            {
                var workspaceExist = await powerBiProvider.CheckWorkspaceExist(input.WorkspaceName).ConfigureAwait(false);

                if (workspaceExist)
                {
                    throw new UserFriendlyException("Workspace name is exist before!");
                }

                Microsoft.PowerBI.Api.V2.Models.Group workspace = powerBiProvider.CreateWorkspace(input.WorkspaceName).Result;
                projectEntity.WorkspaceId = workspace.Id;
            }
            #endregion

            #region Insert new project
            almProvider = iocResolver.Resolve <IAlmProvider>(input.IsOnPremProject ? "TFS" : "TFSOnline");
            almProvider.PrepairProjectForCreation(projectEntity);
            projectEntity = await projectRepository.InsertAsync(projectEntity).ConfigureAwait(false);

            CurrentUnitOfWork.SaveChanges();
            #endregion

            #region Insert All Project Iterations In To DB
            List <Iteration> iterationsList = almProvider.GetIterationsList(projectEntity.ProjectId);
            foreach (Iteration iteration in iterationsList)
            {
                Iteration existsIteration = iterationRepository.FirstOrDefault(i => i.IterationSourceId == iteration.IterationSourceId && i.ProjectId == projectEntity.ProjectId);
                if (existsIteration == null)
                {
                    iterationRepository.Insert(iteration);
                }
                else
                {
                    existsIteration.Depth               = iteration.Depth;
                    existsIteration.Scope               = iteration.Scope;
                    existsIteration.EndDate             = iteration.EndDate;
                    existsIteration.StartDate           = iteration.StartDate;
                    existsIteration.LastUpdatedDateTime = DateTime.UtcNow;
                    existsIteration.IterationName       = iteration.IterationName;
                    iterationRepository.Update(existsIteration);
                }
            }
            #endregion

            #region Handle project work items
            List <Epic> epics = almProvider.GetEpics(input.FromDate, input.ToDate);
            await Sync(projectEntity.ProjectId, epics, epicRepository).ConfigureAwait(false);

            List <Feature> features = almProvider.GetFeatures(input.FromDate, input.ToDate);
            await Sync(projectEntity.ProjectId, features, featureRepository).ConfigureAwait(false);

            List <Bug> onlineBugsIdsList = almProvider.GetBugs(input.FromDate, input.ToDate);
            await Sync(projectEntity.ProjectId, onlineBugsIdsList, bugRepository).ConfigureAwait(false);

            List <ALM.Task> onlineTasksIdsList = almProvider.GetTasks(input.FromDate, input.ToDate);
            await Sync(projectEntity.ProjectId, onlineTasksIdsList, taskRepository).ConfigureAwait(false);

            List <UserStory> onlineUserStories = almProvider.GetUserStories(input.FromDate, input.ToDate);
            await Sync(projectEntity.ProjectId, onlineUserStories, userStoryRepository).ConfigureAwait(false);

            List <Assignee> onlineTeamMembersList = almProvider.GetAssigneesNames(projectEntity.ProjectId);
            await CompareAssigneesListAsync(onlineTeamMembersList, projectEntity.ProjectId).ConfigureAwait(false);

            #endregion

            #region Insert Project Details
            ProjectDetail projectDetails = new ProjectDetail
            {
                CreationDate     = DateTime.UtcNow,
                PullDataFromDate = input.FromDate,
                ProjectId        = projectEntity.ProjectId,
                PullDataToDate   = input.ToDate ?? default(DateTime)
            };
            projectDetailsRepository.Insert(projectDetails);
            #endregion

            return(MapToEntityDto(projectEntity));
        }