public async Task <ActionResult> Receive([FromBody] ReceiveModel receiveModel)
        {
            var bag = await bagRepository.GetBag(receiveModel.BagId);

            if (bag == null)
            {
                return(Ok(new ReceiveResultModel
                {
                    Status = ReceiveStatus.UNKNOWN,
                    BagId = receiveModel.BagId
                }));
            }

            bag.Value           = receiveModel.Value;
            bag.Status          = BagStatus.Recieved;
            bag.ReceiveDate     = DateTime.UtcNow;
            bag.ReceiveLocation = receiveModel.Location;
            bag.Weight          = receiveModel.Weight;

            await bagRepository.AddOrUpdateAsync(bag);

            return(Ok(new ReceiveResultModel
            {
                Status = ReceiveStatus.OK,
                BagId = bag.BagId,
            }));
        }
        public async Task <ActionResult> Activate([FromBody] ActivateModel activateModel)
        {
            if (string.IsNullOrEmpty(activateModel.UserId))
            {
                activateModel.UserId = Guid.NewGuid().ToString();
                await authService.AnonymousUser(activateModel.UserId);
            }

            var user = await authService.EnsureAndGetUserAsync();

            if (user == null && !string.IsNullOrEmpty(activateModel.UserId))
            {
                user = await userRepository.RegisterUser(activateModel.UserId, null, null, null);
            }

            var bag = await bagRepository.GetUnusedAsync(activateModel.BagId);

            if (bag == null)
            {
                return(Ok(new ActivateResultModel
                {
                    Status = ActivativateStatus.Unknown,
                    UserId = activateModel.UserId
                }));
            }

            await bagRepository.DeleteAsync(bag);

            var newBag = new Bag(activateModel.UserId, bag.BagId)
            {
                CreatedDate = bag.CreatedDate,
                Status      = BagStatus.Active
            };

            await bagRepository.AddOrUpdateAsync(newBag);

            return(Ok(new ActivateResultModel
            {
                Status = ActivativateStatus.OK,
                UserId = newBag.UserId,
                BagId = newBag.BagId
            }));
        }