public async Task <PhotoDto> Handle(Command request, CancellationToken cancellationToken)
            {
                var existingUser = await _context.Users
                                   .Include(qu => qu.Photos)
                                   .SingleOrDefaultAsync(u => u.UserName == _userAccessor.GetCurrentUserName());

                if (existingUser == null)
                {
                    throw new RestException(HttpStatusCode.Unauthorized, "Unauthorized access");
                }

                var uploadResult = await _photoAccessor.UploadFileAsync(request.File);

                var newPhoto = new Photo
                {
                    Url = uploadResult.Url,
                    Id  = uploadResult.PublicId
                };

                if (!existingUser.Photos.Any(p => p.IsMain))
                {
                    newPhoto.IsMain = true;
                }
                existingUser.Photos.Add(newPhoto);


                var saveCount = await _context.SaveChangesAsync() > 0;

                if (!saveCount)
                {
                    throw new Exception("Problem saving changes");
                }

                return(_mapper.Map <PhotoDto>(newPhoto));;
            }