public async Task <IActionResult> CreateNextstepUser([FromBody] NextstepUser nextstepUser)
        {
            await _context.NextstepUsers.AddAsync(nextstepUser);

            await _context.SaveChangesAsync();

            return(Ok(nextstepUser));
        }
        public async Task <IActionResult> CreateActivityWithNextStep([FromBody] CreateActivityAndNextStepDto createActivityAndNextStepDto)
        {
            var UsersId = int.Parse(User.FindFirst("UsersId").Value);

            var activityDate = new DateTime();

            if (createActivityAndNextStepDto.Time != null || createActivityAndNextStepDto.Date != null)
            {
                var splittedTime = createActivityAndNextStepDto.Time.Split(":");
                activityDate = DateTime.Parse(createActivityAndNextStepDto.Date).AddHours(double.Parse(splittedTime[0])).AddMinutes(double.Parse(splittedTime[1]));
            }
            var newActivity = new Activity()
            {
                Title       = createActivityAndNextStepDto.Title,
                Description = createActivityAndNextStepDto.Description,
                Date        = activityDate,
                Type        = createActivityAndNextStepDto.Type,
                CreatorId   = UsersId,
                Archived    = false
            };

            if (createActivityAndNextStepDto.CustomerId != 0)
            {
                newActivity.CustomerId = createActivityAndNextStepDto.CustomerId;
            }

            await _context.Activities.AddAsync(newActivity);

            await _context.SaveChangesAsync();

            var nextStepSplittedTime = createActivityAndNextStepDto.NextstepTime.Split(":");
            var nextStepDate         = DateTime.Parse(createActivityAndNextStepDto.NextstepDate)
                                       .AddHours(double.Parse(nextStepSplittedTime[0]))
                                       .AddMinutes(double.Parse(nextStepSplittedTime[1]));

            var newNextStep = new NextStep()
            {
                Title       = createActivityAndNextStepDto.NextstepTitle,
                Description = createActivityAndNextStepDto.NextstepDescription,
                Date        = nextStepDate,
                Type        = createActivityAndNextStepDto.NextstepType,
                CreatorId   = UsersId,
                ActivityId  = newActivity.Id
            };

            await _context.NextStep.AddAsync(newNextStep);

            await _context.SaveChangesAsync();

            newActivity.NextStepId = newNextStep.Id;
            await _context.SaveChangesAsync();

            // Check if users or contactpersons are null

            if (createActivityAndNextStepDto.UsersForActivity != null)
            {
                foreach (var user in createActivityAndNextStepDto.UsersForActivity)
                {
                    var activityUser = new ActivityUser()
                    {
                        UserId     = user.Id,
                        ActivityId = newActivity.Id
                    };
                    await _context.ActivityUsers.AddAsync(activityUser);
                }
            }

            if (createActivityAndNextStepDto.ContactpersonsForActivity != null)
            {
                foreach (var contactperson in createActivityAndNextStepDto.ContactpersonsForActivity)
                {
                    var activityContactperson = new ActivityContactperson()
                    {
                        ContactpersonId = contactperson.Id,
                        ActivityId      = newActivity.Id
                    };
                    await _context.ActivityContactpersons.AddAsync(activityContactperson);
                }
            }

            if (createActivityAndNextStepDto.NextstepUsersForActivity != null)
            {
                foreach (var user in createActivityAndNextStepDto.NextstepUsersForActivity)
                {
                    var nextStepUser = new NextstepUser()
                    {
                        UserId     = user.Id,
                        NextstepId = newNextStep.Id
                    };
                    await _context.NextstepUsers.AddAsync(nextStepUser);
                }
            }

            if (createActivityAndNextStepDto.NextstepContactpersonsForActivity != null)
            {
                foreach (var contactperson in createActivityAndNextStepDto.NextstepContactpersonsForActivity)
                {
                    var nextstepContactperson = new NextstepContactperson()
                    {
                        ContactpersonId = contactperson.Id,
                        NextstepId      = newNextStep.Id
                    };
                    await _context.NextstepContactpersons.AddAsync(nextstepContactperson);
                }
            }


            await _context.SaveChangesAsync();

            return(Ok(createActivityAndNextStepDto));
        }