public async Task <IActionResult> Save(
            string activityId,
            string name,
            DateTime logged,
            decimal miles,
            decimal lowestElevation,
            decimal highestElevation,
            decimal totalElevation,
            decimal averageSpeed,
            decimal topSpeed,
            int duration)
        {
            var user = await userManager.GetUserAsync(User);

            if (user == null || !user.IsStravaAccount)
            {
                return(Forbid());
            }

            if (string.IsNullOrWhiteSpace(activityId) || miles <= 0)
            {
                return(BadRequest());
            }

            var saveCommand = new SaveActivityCommand
            {
                Skater               = user,
                Distance             = miles,
                DistanceUnit         = DistanceUnit.Miles,
                StartDate            = logged,
                StavaActivityId      = activityId,
                Name                 = name,
                LowestElevation      = lowestElevation,
                LowestElevationUnit  = DistanceUnit.Feet,
                HighestElevation     = highestElevation,
                HighestElevationUnit = DistanceUnit.Feet,
                ElevationGain        = totalElevation,
                ElevationGainUnit    = DistanceUnit.Feet,
                AverageSpeed         = averageSpeed,
                AverageSpeedUnit     = VelocityUnit.MilesPerHour,
                TopSpeed             = topSpeed,
                TopSpeedUnit         = VelocityUnit.MilesPerHour,
                Duration             = duration
            };

            await mediator.Send(saveCommand);

            return(Ok());
        }
        public async Task <IActionResult> Index([FromForm] SkaterLogViewModel mileageEntry)
        {
            var user = await userManager.GetUserAsync(User);

            if (!TryValidateModel(mileageEntry, nameof(SkaterLogViewModel)))
            {
                var model = await viewModelBuilder.WithNewEntry(mileageEntry).WithUser(user).Build();

                return(View("~/Views/Skater/Log.cshtml", model));
            }
            else
            {
                var command = new SaveActivityCommand
                {
                    Skater               = user,
                    Name                 = mileageEntry.JourneyName,
                    Distance             = mileageEntry.Distance,
                    DistanceUnit         = mileageEntry.DistanceUnit,
                    StartDate            = mileageEntry.DateSkated ?? DateTime.Now,
                    AverageSpeed         = mileageEntry.AverageSpeed,
                    AverageSpeedUnit     = mileageEntry.VelocityUnit,
                    TopSpeed             = mileageEntry.TopSpeed,
                    TopSpeedUnit         = mileageEntry.VelocityUnit,
                    LowestElevation      = mileageEntry.LowestElevation,
                    LowestElevationUnit  = mileageEntry.ElevationUnit,
                    HighestElevation     = mileageEntry.HighestElevation,
                    HighestElevationUnit = mileageEntry.ElevationUnit,
                    ElevationGain        = mileageEntry.ElevationGain,
                    ElevationGainUnit    = mileageEntry.ElevationUnit
                };

                var saveResponse = await mediator.Send(command);

                var model = await viewModelBuilder.WithSaveResponse(saveResponse).WithNewEntry(new SkaterLogViewModel()).WithUser(user).Build();

                return(View("~/Views/Skater/Log.cshtml", model));
            }
        }