public async Task <IActionResult> RegistrationPost([FromBody, Required] Register registration)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //TODO There must be a better in oder to check whether a user is sign in or not.
                    var result = await signInMgt.PasswordSignInAsync(registration.Email, registration.Password, true, false);

                    if (!result.Succeeded)
                    {
                        if (repository.CreateEntry(registration).Result)
                        {
                            logger.LogInformation("A new user had been added to the database.");
                            return(StatusCode(201));
                        }
                        logger.LogTrace("User could not be added to the database.");
                        return(StatusCode(403, "User could not be added to the database."));
                    }
                    logger.LogWarning("User is already stored in the database.");
                    return(StatusCode(300, "User is already stored in the database."));
                }
                catch (Exception ex)
                {
                    logger.LogError($"DB request failed. {ex.Message}");
                    return(StatusCode(500, "Internal server error, most likely because of the database."));
                }
            }
            logger.LogInformation("User cannot be stored in the DB, because the credentials are most likely not valid.(400)");
            return(BadRequest($"Probably the credentials are not valid. {registration}"));
        }
        /// <summary>
        /// Seed the database, when it was empty before.
        /// </summary>
        /// <returns>
        /// The Task class is required for the Wait() operator while seeding the database.
        /// </returns>
        public async Task EnsureSeedData()
        {
            //Check whether the default user exists.
            if (await userManagerIdentity.FindByEmailAsync("*****@*****.**") == null)
            {
                //Just for seeding purpose.
                var user = new Register()
                {
                    Email    = "*****@*****.**",
                    Password = "******"
                };

                //Stores the default user infromation in the database
                if (repository.CreateEntry(user).Result)
                {
                    throw new TaskSchedulerException("Seeding of default user was not successful.");
                }
            }
        }