private UserModel GetUserStateInfo(Boolean isAuthenticated, String username, Int32 id = 0)
        {
            var model = new UserModel()
            {
                IsAuthenticated = isAuthenticated,
                Username = username
            };

            if (id > 0)
            {
                try
                {
                    IDelightServices service = new DelightServices();

                    AccountAvatarDTO info = service.GetUserStateInfo(id);
                    model.Remember = info.Remember;
                    if (model.Remember)
                    {
                        model.Username = info.Username;
                        model.Avatar = DataUriSchemeProvider.CreatePNGImage(info.Avatar);
                    }
                    if (model.IsAuthenticated)
                    {
                        model.Role = info.Role;
                    }

                }
                catch (RepositoryException)
                {
                }
            }

            return model;
        }