protected async Task <HttpRequestMessage> CreateRequestAsync(User user, string currentOrganizationId = null, HttpMethod method = null, string url = "api/v1/contacts", bool isCompressed = false, string mediaType = "application/json", string charSet = "utf-8", IPrincipal principal = null)
        {
            var context = new OwinContext();

            if (user != null)
            {
                if (String.IsNullOrEmpty(currentOrganizationId))
                {
                    currentOrganizationId = user.Memberships.Any() ? user.Memberships.First().OrganizationId : null;
                }

                context.Request.User = new ClaimsPrincipal(IdentityService.CreateUserIdentity(user.EmailAddress, user.Id, new List <string>(), new Membership {
                    OrganizationId = currentOrganizationId,
                    //Roles = new List<string> { AuthorizationRoles.GlobalAdmin }
                }));

                context.Set("User", user);
            }

            context.Set("Organization", _testOrganization != null && _testOrganization.Id == currentOrganizationId ? _testOrganization : await _organizationRepository.GetByIdAsync(currentOrganizationId, true));
            context.Request.User = new ClaimsPrincipal(IdentityService.CreateUserIdentity(user.EmailAddress, user.Id, new List <string>(), new Membership {
                OrganizationId = currentOrganizationId,
                //Roles = new List<string> { AuthorizationRoles.GlobalAdmin }
            }));

            return(await CreateRequestAsync(context, currentOrganizationId, method, url, isCompressed, mediaType, charSet));
        }