public Result <Playground.Model.Playground> AddPlayground(Playground.Model.Playground playground)
        {
            Result <Playground.Model.Playground> retVal = null;

            try
            {
                playground.CreationDate = DateTime.Now;
                Uow.Playgrounds.Add(playground);
                Uow.Commit();

                PlaygroundUser playgroundUser = new PlaygroundUser()
                {
                    UserID       = playground.OwnerID,
                    PlaygroundID = playground.PlaygroundID
                };
                AddUserToPlaygroound(playgroundUser);

                retVal = ResultHandler <Playground.Model.Playground> .Sucess(playground);
            }
            catch (Exception ex)
            {
                log.Error("Erorr adding playgorund", ex);
                retVal = ResultHandler <Playground.Model.Playground> .Erorr("Error adding playground");
            }

            return(retVal);
        }
        public HttpResponseMessage RemoveeGameFromPlayground([FromUri] PlaygroundUser playgroundUser)
        {
            bool success = playgroundBusiness.RemoveUserFromPlayground(playgroundUser);

            HttpResponseMessage response = success ?
                                           Request.CreateResponse(HttpStatusCode.Created, success) :
                                           Request.CreateResponse(HttpStatusCode.InternalServerError, "Eror removing user from playground");

            return(response);
        }
        public HttpResponseMessage AddUserToPlayground(PlaygroundUser playgroundUser)
        {
            bool success = playgroundBusiness.AddUserToPlaygroound(playgroundUser);

            HttpResponseMessage response = success ?
                                           Request.CreateResponse(HttpStatusCode.Created, success) :
                                           Request.CreateResponse(HttpStatusCode.InternalServerError, "Eror adding user to playground");

            return(response);
        }
        public bool RemoveUserFromPlayground(PlaygroundUser playgroundUser)
        {
            bool retVal = true;

            try
            {
                Uow.PlaygroundUsers.Delete(playgroundUser);
                Uow.Commit();
            }
            catch (Exception ex)
            {
                log.Error(String.Format("Erorr deleting user from palyground, userID: {0}, playgroundID: {1}",
                                        playgroundUser.UserID,
                                        playgroundUser.PlaygroundID), ex);
                retVal = false;
            }

            return(retVal);
        }
        public bool AddUserToPlaygroound(PlaygroundUser playgroundUser)
        {
            bool retVal = true;

            try
            {
                Uow.PlaygroundUsers.Add(playgroundUser);
                Uow.Commit();
            }
            catch (Exception ex)
            {
                log.Error(String.Format("Erorr adding user to palyground, userID: {0}, playgroundID: {1}",
                                        playgroundUser.UserID,
                                        playgroundUser.PlaygroundID), ex);
                retVal = false;
            }

            return(retVal);
        }