public async Task <StatusCodeResult> SendMessage(string login, string password, string opponentId, string text)
        {
            var user = await _context.Users.FirstOrDefaultAsync(e => e.UserName == login);

            if (user == null)
            {
                //this.HttpContext.Response.StatusCode = 404;
                return(StatusCode(403));
            }
            else
            {
                var signInRezult = await _signInManager.CheckPasswordSignInAsync(user, password, false);

                if (signInRezult.Succeeded)
                {
                    await _messageServicePost.PostMessage(_context, user, opponentId, text);

                    return(StatusCode(200));
                }
                else
                {
                    this.HttpContext.Response.StatusCode = 401;
                    return(StatusCode(401));
                }
            }
        }
        /// <summary>
        /// Executes the business logic.
        /// </summary>
        public override void Execute()
        {
            Trace(string.Format(CultureInfo.InvariantCulture, TraceMessageHelper.EnteredMethod, UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name));

            using (OrganizationServiceContext = OrganizationServiceContext ?? new CrmServiceContext(OrganizationService))
                using (CrmService = CrmService ?? new CrmService(OrganizationServiceContext, TracingService))
                    using (PostMessageService = PostMessageService ?? new PostMessageService(CrmService, OrganizationServiceContext, PluginExecutionContext, TracingService))
                    {
                        Trace(string.Format(CultureInfo.InvariantCulture, "{0} | {1} started at {2} milliseconds", UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name, Stopwatch.ElapsedMilliseconds));
                        PostMessageService.PostMessage();
                        Trace(string.Format(CultureInfo.InvariantCulture, "{0} | {1} ended at {2} milliseconds", UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name, Stopwatch.ElapsedMilliseconds));
                    }

            Trace(string.Format(CultureInfo.InvariantCulture, TraceMessageHelper.ExitingMethod, UnderlyingSystemTypeName, MethodBase.GetCurrentMethod().Name));
        }