public async Task <dynamic> Get()
        {
            var userId = this.GetCurrentUserId();

            var(creationDate, expiryDate, token) = await AuthenticationUtils.GenerateJwtTokenForUser(userId, TokenConfigurations, SigningConfigurations);

            Response.StatusCode = (int)HttpStatusCode.OK;

            return(new ResponseBody()
            {
                Message = "Token renovado com sucesso!",
                Code = ResponseCode.GenericSuccess,
                Success = true,
                Data = new
                {
                    tokenData = new
                    {
                        created = creationDate,
                        expiration = expiryDate,
                        accessToken = token,
                    }
                }
            });
        }
        [AllowAnonymous] // No authorization required for Register Request, obviously
        public async Task <dynamic> Post([FromBody] TBody requestBody)
        {
            this.EnsureModelValidation();

            var userCollection = MongoWrapper.Database.GetCollection <Models.User>(nameof(Models.User));

            await RegistrarUtils.TestUserExists(this, userCollection, requestBody.Email);

            ResponseBody responseBody = new ResponseBody();

            DateTime creationDate = DateTime.UtcNow;

            var user = await BindUser(requestBody, creationDate);

            // 300MB file storage limit default
            user.FileBytesLimit = 300_000_000;

            var gridFsBucket = new GridFSBucket <ObjectId>(MongoWrapper.Database);

            Task photoTask = this.UploadPhoto(requestBody.Foto, gridFsBucket, user, creationDate);

            var insertTask = userCollection.InsertOneAsync(user);

            try
            {
                await insertTask;
            }
            catch (Exception e)
            {
                Logger.LogError("Error while registering user", e);
                try
                {
                    await    photoTask;
                    ObjectId?photoId = user?.Avatar?._id;
                    if (photoId.HasValue)
                    {
                        var deleteLingeringPhotoTask = gridFsBucket.DeleteAsync(photoId.Value);
                    }
                }
                catch
                {
                    // Ignore, no need to erase photo or log anything: User's insert has failed anyways.
                }
                throw;
            }

            // Não esperamos o e-mail ser enviado, apenas disparamos. Caso não tenha sido enviado vai ter um botão na home depois enchendo o saco pro usuário confirmar o e-mail dele.
            var sendEmailTask = EmailUtils.SendConfirmationEmail(MongoWrapper, SmtpConfiguration, user);

            var(tokenCreationDate, tokenExpiryDate, token) = await AuthenticationUtils.GenerateJwtTokenForUser(user._id.ToString(), TokenConfigurations, SigningConfigurations);

            responseBody.Message = "Registro efetuado com sucesso. Não se esqueça de confirmar seu e-mail!";
            responseBody.Code    = ResponseCode.GenericSuccess;
            responseBody.Success = true;
            responseBody.Data    = new
            {
                tokenData = new
                {
                    created     = tokenCreationDate,
                    expiration  = tokenExpiryDate,
                    accessToken = token,
                }
            };
            Response.StatusCode = (int)HttpStatusCode.OK;
            return(responseBody);
        }
        [AllowAnonymous] // No authorization required for Login Request, obviously
        public async Task <dynamic> Post([FromBody] LoginRequest requestBody)
        {
            this.EnsureModelValidation();

            var collection = MongoWrapper.Database.GetCollection <Models.User>(nameof(User));

            var projectionBuilder = new ProjectionDefinitionBuilder <Models.User>();
            var projection        = projectionBuilder
                                    .Include(u => u.Password)
                                    .Include(u => u.Avatar)
                                    .Include(u => u.FullName)
                                    .Include("_t");

            var filterBuilder = new FilterDefinitionBuilder <Models.User>();
            var filter        = filterBuilder.And(
                filterBuilder.Eq(u => u.Email, requestBody.Email),
                GeneralUtils.NotDeactivated(filterBuilder)
                );

            var user = (await collection.FindAsync(filter, new FindOptions <Models.User>
            {
                Limit = 1,
                Projection = projection,
            })).SingleOrDefault();

            var responseBody = new ResponseBody();

            if (user == null)
            {
                responseBody.Code    = ResponseCode.NotFound;
                responseBody.Success = false;
                responseBody.Message = "Usuário não encontrado!";
                Response.StatusCode  = (int)HttpStatusCode.Unauthorized;
                return(responseBody);
            }

            var passwordMatchesTask = Task.Run(() => Encryption.Compare(requestBody.Password, user.Password));

            var(creationDate, expiryDate, token) = await AuthenticationUtils.GenerateJwtTokenForUser(user._id.ToString(), TokenConfigurations, SigningConfigurations);

            bool passwordMatches = await passwordMatchesTask;

            if (!passwordMatches)
            {
                responseBody.Message = "Senha incorreta!";
                responseBody.Code    = ResponseCode.IncorrectPassword;
                responseBody.Success = false;
                Response.StatusCode  = (int)HttpStatusCode.Unauthorized;
                return(responseBody);
            }

            responseBody.Message = "Login efetuado com sucesso!";
            responseBody.Code    = ResponseCode.GenericSuccess;
            responseBody.Success = true;
            responseBody.Data    = new
            {
                user = new
                {
                    user.Kind,
                    user.Avatar,
                    user.FullName,
                },
                tokenData = new
                {
                    created     = creationDate,
                    expiration  = expiryDate,
                    accessToken = token,
                }
            };
            Response.StatusCode = (int)HttpStatusCode.OK;
            return(responseBody);
        }